Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 13630 | Accepted: 8796 |
本题是比较水的,只要对n个监狱扫描一遍,看哪一个监狱被光顾了奇数次,就s++一次
代码:
1 #include<stdio.h>
2 int main()
3 {
4 int n,j,i,count,s,m;
5 scanf("%d",&m);
6 while(m--)
7 {
8 scanf("%d",&n);
9 s=0;
10 for(i=1;i<=n;i++)
11 {
12 count=0;
13 for(j=1;j<=i;j++)
14 if(i%j==0)
15 count++;
16 if(count%2!=0)
17 s++;
18 }
19 printf("%d\n",s);
20 }
21 return 0;
22 }
23