首页 > 其他 > 详细

hdu 1337 The Drunk Jailer

时间:2014-07-22 22:45:22      阅读:256      评论:0      收藏:0      [点我收藏+]

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

bubuko.com,布布扣
 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 1337 The Drunk Jailer,布布扣,bubuko.com

hdu 1337 The Drunk Jailer

原文:http://www.cnblogs.com/fanminghui/p/3859740.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!