hdu 1337 The Drunk Jailer

http://acm.hdu.edu.cn/showproblem.php?pid=1337

 1 #include <cstdio>

 2 #include <cstring>

 3 #define maxn 200

 4 using namespace std;

 5 int main()

 6 {

 7     int t;

 8     int a[maxn];

 9     scanf("%d",&t);

10     int n;

11     while(t--)

12     {

13         scanf("%d",&n);

14         for(int i=1; i<=maxn; i++) a[i]=1;

15         for(int i=1; i<=n; i++)

16         {

17             for(int j=i; j<=n; j+=i)

18             {

19                 a[j]^=1;

20             }

21         }

22         int ans=0;

23         for(int i=1; i<=n; i++)

24         {

25             if(!a[i]) ans++;

26         }

27         printf("%d\n",ans);

28     }

29     return 0;

30 }
View Code

你可能感兴趣的:(HDU)