比赛 |
20110725 |
评测结果 |
AAAAAAAWWW |
题目名称 |
失落的神庙 |
最终得分 |
70 |
用户昵称 |
PurpleShadow |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2011-07-25 11:44:43 |
显示代码纯文本
- #include <cstdio>
- #include <cstring>
- const int N=10000010;
- typedef long long LL;
- LL n;
- long long F[N];
- LL find(int n)
- {
- if (n<N) return F[n];else
- return find(n/2)+find(n/3)+find(n/5)+find(n/7);
- }
- int main()
- {
- freopen("losttemple.in","r",stdin);
- freopen("losttemple.out","w",stdout);
- scanf("%lld",&n);
- F[0]=1;F[1]=1;
- for (int i=2;i<N;++i)
- F[i]=F[i/2]+F[i/3]+F[i/5]+F[i/7];
- if (n<N) printf("%lld\n",F[n]);else printf("%lld\n",find(n));
- return 0;
- }