首页 > 代码库 > hdu 1337 The Drunk Jailer
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 }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。