No Description

wolves 160a668b19 Add repository guidelines (AGENTS.md) 8 months ago
.cache 6b74b03d0f 251112 9 months ago
23 3f58f483ff init 11 months ago
24 3f58f483ff init 11 months ago
25 a1094d0d17 717 8 months ago
dataStruct 3f58f483ff init 11 months ago
dynamic planning a96de06a95 Rename *22.cpp to 22.cpp 10 months ago
else 3f58f483ff init 11 months ago
greed 3f58f483ff init 11 months ago
key 3f58f483ff init 11 months ago
test 3f58f483ff init 11 months ago
tools 3f58f483ff init 11 months ago
we 3f58f483ff init 11 months ago
.clangd 6b74b03d0f 251112 9 months ago
.gitignore 3f58f483ff init 11 months ago
AGENTS.md 160a668b19 Add repository guidelines (AGENTS.md) 8 months ago
CLAUDE.md a1094d0d17 717 8 months ago
README.md 3f58f483ff init 11 months ago
main.c 3f58f483ff init 11 months ago
main.go 3f58f483ff init 11 months ago
tools.h 3f58f483ff init 11 months ago

README.md

  • 02/2506
    • for (const string &word : words)
      {
      int state = 0;
      for (char c : word)
      {
          state |= 1 << (c - 'a');
      }
      res += cnt[state];
      cnt[state]++;
      }
      
    • 这是一种位压缩算法,巧妙的利用二进制的位来表示一个单词中出现的所有字母。

    • 关键就是state |= 1 << (c - 'a');这一行。这一行的作用是将state的第(c - 'a')位设为1,这样就可以表示这个单词中出现了字母c。

备用站点 当前处于降级运行的备用站点,仅供应急访问,数据和功能可能不是最新。