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