比赛 20130923 评测结果 AAAAAAAAAA
题目名称 鬼谷子的钱袋 最终得分 100
用户昵称 devil 运行时间 0.002 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2015-10-12 19:15:15
显示代码纯文本
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <cstdio>
  4. #include <cstdlib>
  5. #include <cstring>
  6. #include <cmath>
  7. #include <map>
  8. #include <stack>
  9. #include <queue>
  10. #include <ctime>
  11. #include <algorithm>
  12. using namespace std;
  13. typedef long long ll;
  14. typedef unsigned long long ull;
  15. typedef long double ld;
  16. typedef unsigned int uint;
  17. const int inf=1061109567;
  18. const int maxn=55;
  19. const int maxm=3000;
  20. const int mod=7777777;
  21.  
  22. int ans[maxn];
  23.  
  24. int main()
  25. {
  26. freopen("wallet.in","r",stdin);
  27. freopen("wallet.out","w",stdout);
  28. //clock_t st=clock();
  29. int n;scanf("%d",&n);
  30. int cnt=0;
  31. while(n)
  32. {
  33. if(n&1) ans[cnt++]=n/2+1;
  34. else ans[cnt++]=n/2;
  35. n/=2;
  36. }
  37. printf("%d\n",cnt);
  38. for(int i=cnt-1;i>=0;i--) printf("%d ",ans[i]);
  39. printf("\n");
  40. //clock_t ed=clock();
  41. //printf("\nTime used : %.5lf Ms\n",double(ed-st)/CLOCKS_PER_SEC);
  42. return 0;
  43. }