Açıklama Yok

wolves bb44fe2957 routine 3 ay önce
.cache 6b74b03d0f 251112 9 ay önce
23 3f58f483ff init 11 ay önce
24 3f58f483ff init 11 ay önce
25 5297b42c6e routine 7 ay önce
26 bb44fe2957 routine 3 ay önce
dataStruct 3f58f483ff init 11 ay önce
dynamic planning a96de06a95 Rename *22.cpp to 22.cpp 10 ay önce
else 3f58f483ff init 11 ay önce
greed 3f58f483ff init 11 ay önce
key 3f58f483ff init 11 ay önce
test 3f58f483ff init 11 ay önce
tools 3f58f483ff init 11 ay önce
we 3f58f483ff init 11 ay önce
.clangd 6b74b03d0f 251112 9 ay önce
.gitignore 3f58f483ff init 11 ay önce
AGENTS.md e030df06c9 1018 8 ay önce
README.md 3f58f483ff init 11 ay önce
go.mod ed9ac364a8 routine 5 ay önce
main.go 3f58f483ff init 11 ay önce
test.go 06508ed118 routine 6 ay önce
tools.h 3f58f483ff init 11 ay önce

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。

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