比赛 |
20130923 |
评测结果 |
AAAAAAAAAA |
题目名称 |
鬼谷子的钱袋 |
最终得分 |
100 |
用户昵称 |
devil |
运行时间 |
0.002 s |
代码语言 |
C++ |
内存使用 |
0.31 MiB |
提交时间 |
2015-10-12 19:15:15 |
显示代码纯文本
- #include <cstdlib>
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <cmath>
- #include <map>
- #include <stack>
- #include <queue>
- #include <ctime>
- #include <algorithm>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- typedef unsigned int uint;
- const int inf=1061109567;
- const int maxn=55;
- const int maxm=3000;
- const int mod=7777777;
-
- int ans[maxn];
-
- int main()
- {
- freopen("wallet.in","r",stdin);
- freopen("wallet.out","w",stdout);
- //clock_t st=clock();
- int n;scanf("%d",&n);
- int cnt=0;
- while(n)
- {
- if(n&1) ans[cnt++]=n/2+1;
- else ans[cnt++]=n/2;
- n/=2;
- }
- printf("%d\n",cnt);
- for(int i=cnt-1;i>=0;i--) printf("%d ",ans[i]);
- printf("\n");
- //clock_t ed=clock();
- //printf("\nTime used : %.5lf Ms\n",double(ed-st)/CLOCKS_PER_SEC);
- return 0;
- }