This commit is contained in:
2026-07-24 09:24:21 +08:00
parent 209d7e2bb3
commit 536a697566
23 changed files with 684 additions and 62 deletions
+32
View File
@@ -0,0 +1,32 @@
#include <cstring>
#include <iostream>
constexpr int N = 105;
static int answers[N] = {0};
static void initAnswers() {
// O(n^3),本题可接受
bool cells[N];
for (int n = 1; n < N; n++) {
memset(cells, false, sizeof(cells));
for (int i = 0; i < n; i++) {
for (int j = i; j < n; j += i + 1) {
cells[j] = !cells[j];
}
}
for (int i = 0; i < n; i++) {
if (cells[i]) { answers[n]++; }
}
}
}
int main() {
initAnswers();
int rounds, n;
std::cin >> rounds;
for (int i = 0; i < rounds; i++) {
std::cin >> n;
std::cout << answers[n] << std::endl;
}
}