hdoj-2053-Switch Game

 1 #include<stdio.h>
 2 #include<string.h>
 3 int main()
 4 {
 5     int a[100001],i,j;
 6     for(i=1;i<=100000;i++)
 7     a[i]=1;
 8     for(i=2;i<=100000;i++).//暴力打表法
 9         for(j=i;j<=100000;j+=i)
10         {
11             if(a[j]==1)
12             a[j]=0;
13             else
14             a[j]=1;
15         }
16     int n;
17     while(scanf("%d",&n)!=EOF)
18     {
19         printf("%d\n",a[n]);
20     }
21     return 0;
22 }

 

posted @ 2013-07-04 11:16  nylg-haozi  阅读(124)  评论(0编辑  收藏  举报