简单题
View Code
#include <iostream> #include <cstdlib> #include <cstdio> #include <cstring> using namespace std; #define maxn 105 bool unlocked[maxn]; int main() { int t; scanf("%d", &t); while (t--) { memset(unlocked, 0, sizeof(unlocked)); int n; scanf("%d", &n); for (int i = 1; i <= n; i++) for (int j = i; j <= n; j += i) unlocked[j] = !unlocked[j]; int ans = 0; for (int i = 1; i <= n; i++) if (unlocked[i]) ans++; printf("%d\n", ans); } return 0; }