Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
代码!#include <stdio.h> #include <string.h> #define M 101 int l[M]; int main() { int cases,i,j,n,count; scanf("%d",&cases); while(cases--) { scanf("%d",&n); memset(l,0,sizeof(l)); for(i=1;i<=n;i++) { j=i; while(j<=n) { if(l[j]) l[j]=0; else l[j]=1; j+=i; } } count=0; for(i=1;i<=n;i++) if(l[i]) count++; printf("%d\n",count); } return 1; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator