Files
python/LuoGu/RuMen/P2084.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

28 lines
587 B
C++

#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false); //读入输出优化的强迫症
int n, x, qaq = 0;
cin >> n;
char a;
queue<char> q, qq;
while (cin >> a) {
if (a == 0) break;
q.push(a);
qaq += (a - '0');
}
x = q.size();
while (!q.empty()) {
x--;
if (q.front() != '0') {
qaq--;
cout << q.front() << '*' << n << '^' << x;
if (x != 0 && qaq != 0) cout << '+';
}
q.pop();
}
return 0;
}