记录编号 138831 评测结果 AAAAAAAAAA
题目名称 [NOIP 2010冲刺五]无穷的序列 最终得分 100
用户昵称 Gravatar乌龙猹 是否通过 通过
代码语言 C++ 运行时间 0.569 s
提交时间 2014-11-06 15:56:38 内存使用 86.09 MiB
显示代码纯文本
  1. #include<cstdio>
  2. #include<cctype>
  3. using namespace std;
  4.  
  5. int ret;
  6. char ch;
  7. int qin()
  8. {
  9. ret=0;
  10. while(ch=getchar(),!isdigit(ch));
  11. while(ret=ret*10+ch-'0',ch=getchar(),isdigit(ch));
  12. return ret;
  13. }
  14.  
  15. int n,x;
  16. int tot=1,ans=2;
  17. bool f[100000001];
  18. int main()
  19. {
  20. freopen("unlessseq.in","r",stdin);
  21. freopen("unlessseq.out","w",stdout);
  22. n=qin();
  23. f[1]=1;
  24. for(int i=1;i<=n;i++)
  25. {
  26. x=qin();
  27. if(x<=tot)
  28. {
  29. printf("%d\n",f[x]);
  30. continue;
  31. }
  32. while(tot<x)
  33. {
  34. tot+=ans;
  35. f[tot+1]=1;
  36. ans++;
  37. }
  38. printf("%d\n",f[x]);
  39. }
  40. return 0;
  41. }