Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
32582 沈仲恩 【S】T1 C++ 通过 100 1 MS 324 KB 694 2024-09-15 13:58:02

Tests(10/10):


#include <bits/stdc++.h> #define int long long using namespace std; int n, ncnt, a[1005]; stack <char> st; inline void get_num(int x) { x += ncnt; while (x != 1) { st.push('+'); ncnt++; if (x & 1) { st.push('1'); x--; } else { st.push('c'); x >>= 1; } } st.push('1'); } signed main() { scanf("%lld", &n); for (int i = 1; i <= n; i++) scanf("%lld", &a[i]); for (int i = n; i >= 1; i--) get_num(a[i]); while (!st.empty()) { putchar(st.top()); st.pop(); } return 0; }


测评信息: