You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
560 B
28 lines
560 B
#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;
|
|
}
|