Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
32584 | 李羽乔 | 【S】T1 | C++ | 通过 | 100 | 2 MS | 316 KB | 608 | 2024-09-15 14:05:24 |
#include<bits/stdc++.h> using namespace std; const int N = 1010,M = 1e5+10; int n,b[N],cnt,tot; char op[M]; void slv(int x){ if(x==1){ op[++cnt]='1'; return; } if(x%2==0){ op[++cnt]='+'; op[++cnt]='c'; tot++; slv(x/2); } else{ op[++cnt]='+'; op[++cnt]='1'; op[++cnt]='+'; op[++cnt]='c'; tot+=2; slv((x-1)/2); } } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>b[i]; } for(int i=n;i>=1;i--){ tot=0; slv(b[i]); for(int j=1;j<i;j++){ b[j]+=tot; } } for(int i=cnt;i>=1;i--){ cout<<op[i]; } cout<<endl; return 0; }