pku 1218 THE DRUNK JAILER 水题again,求因子个数

题目罗嗦一堆,就是求1-100内每个数的因子个数~,然后再求累加和
不废话了,上代码

 1# include <cstdio>
 2# include <cstring>
 3using namespace std;
 4int main()
 5{
 6    int count[101];
 7    memset(count,0,sizeof(count));
 8    for(int i=1;i<=100;i++)
 9    {
10       int t=0;
11       for(int j=1;j<=i;j++)
12         if(i%j==0) t++;
13       count[i]=t%2+count[i-1];
14    }

15    int n;
16    scanf("%d",&n);
17    while(n--)
18    {
19        int t;
20        scanf("%d",&t);
21        printf("%d\n",count[t]);
22    }

23    return 0;
24    
25}

26

posted on 2011-01-16 14:27 yzhw 阅读(186) 评论(0)  编辑 收藏 引用 所属分类: simple problem~


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2011年1月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
303112345

导航

统计

公告

统计系统

留言簿(1)

随笔分类(227)

文章分类(2)

OJ

最新随笔

搜索

积分与排名

最新评论

阅读排行榜