修改目录结构,优化CMakeLists

This commit is contained in:
2024-09-16 08:12:23 +08:00
parent a1127e008f
commit 1e9de7c9c2
27 changed files with 6 additions and 26 deletions

39
src/191.c Normal file
View File

@@ -0,0 +1,39 @@
#define S2
int hammingWeight(int n)
{
#ifdef S1
int weight = 0;
for (int i = 0; i < 32; i++)
if (n & (1u << i))
weight++;
return weight;
#endif
#ifdef S1_O
int weight = 0;
while (n)
{
n &= n - 1;
weight++;
}
return weight++;
#endif
#ifdef S2
unsigned i = (unsigned)n;
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
i = (i + (i >> 4)) & 0x0f0f0f0f;
i = i + (i >> 8);
i = i + (i >> 16);
return (int)(i & 0x3f);
#endif
}
int main()
{
return 0;
}