I - Count
2013-04-24 12:45
17 查看
I -
Count
这个题目也不能说什么了,忽略了一个条件,本来以为爆难,结果。。。发现问题后,就出来了
#include<cstdio>
#include<cstring>
int ans[1005];
void getans()
{
ans[1]=1;
ans[2]=1;
ans[3]=2;
ans[4]=3;
for(int i=5;i<1001;i++)
{
for(int j=1;j<i;j++)
{
if((i-1)%j == 0)
{
ans[i] += ans[j];
ans[i] %= 1000000007;
};
}
}
}
int main()
{
int n,ncase=1;
memset(ans,0,sizeof(ans));
getans();
while(scanf("%d",&n)!=EOF)
{
printf("Case %d: %d\n",ncase++,ans
);
}
return 0;
}
Count
这个题目也不能说什么了,忽略了一个条件,本来以为爆难,结果。。。发现问题后,就出来了
#include<cstdio>
#include<cstring>
int ans[1005];
void getans()
{
ans[1]=1;
ans[2]=1;
ans[3]=2;
ans[4]=3;
for(int i=5;i<1001;i++)
{
for(int j=1;j<i;j++)
{
if((i-1)%j == 0)
{
ans[i] += ans[j];
ans[i] %= 1000000007;
};
}
}
}
int main()
{
int n,ncase=1;
memset(ans,0,sizeof(ans));
getans();
while(scanf("%d",&n)!=EOF)
{
printf("Case %d: %d\n",ncase++,ans
);
}
return 0;
}
相关文章推荐
- FZU Problem 2105 Digits Count线段树之延迟更新(插线取线)
- 【BZOJ1036】树的统计Count-树链剖分模板题
- spoj cot Count on a tree
- LintCode_249 Count of Smaller Number before itself
- Hadoop提供了最简单的Map/Reduce编程实例WordCount,本文对该Demo的程序结构,以及Map/Reduce框架的注意事项,进行了分析。
- Mysql --found_rows()与row_count()
- Hadoop学习笔记---1.wordcount程序的剖析
- SPOJ COT Count on a tree (树上k大 主席树模板)
- hdu3336 Count the string kmp+dp
- 非修改性序列算法之count和count_if
- Count and Say
- linq lambda group count 创建新实体
- HDU 3336 Count the string
- LintCode_249 Count of Smaller Number before itself
- 关于使用count(X) 函数的说明(附加:关于null的说明以及和0的区别)
- 357.leetcode Count Numbers with Unique Digits(easy)[数学问题 非重复数字]
- 关于count(1) 和 count(*)
- 第一个hadoop入门程序WordCount
- Windows下Cygwin环境的Hadoop安装(3)- 运行hadoop中的wordcount实例遇到的问题和解决方法
- hadoop基础----hadoop实战(三)-----hadoop运行MapReduce---对单词进行统计--经典的自带例子wordcount