提交时间:2024-09-15 13:57:55
运行 ID: 32581
#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() { freopen("polaris.in", "r", stdin); freopen("polaris.out", "w", stdout); 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; }