Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
32575 | LYLAKIOI | 【S】T1 | C++ | 通过 | 100 | 1 MS | 272 KB | 1203 | 2024-09-15 13:14:16 |
#include<bits/stdc++.h> #define up(i,l,r) for(int i=(l);i<=(r);++i) #define down(i,l,r) for(int i=(l);i>=(r);--i) #define pi pair<int,int> #define p1 first #define p2 second #define p_b push_back #define m_p make_pair #define ppc __builtin_popcount using namespace std; typedef long long ll; const int maxn=1e6+10; inline ll read(){ ll x=0;short t=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();} while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar(); return x*t; }int n,a[maxn]; int get(int x){ int cnt=0; while(x!=1)cnt++,cnt+=(x&1),x>>=1; return cnt; } void opt(int x){ vector<int>S; while(x)S.p_b(x),x>>=1; reverse(S.begin(),S.end()); int sz=S.size(); putchar('1'); up(i,1,sz-1){ if(S[i]==S[i-1]*2)putchar('c'),putchar('+'); else putchar('c'),putchar('+'),putchar('1'),putchar('+'); } } void slv(){ n=read();up(i,1,n)a[i]=read(); int s=0;down(i,n,1)a[i]+=s,s+=get(a[i]); up(i,1,n)opt(a[i]); }int main(){ //freopen("polaris.in","r",stdin); //freopen("polaris.out","w",stdout); slv(); fclose(stdin); fclose(stdout); return 0; }