码迷,mamicode.com
首页 > 其他好文 > 详细

hdu 1337 The Drunk Jailer

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

标签:style   blog   http   color   os   io   

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

标签:style   blog   http   color   os   io   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!