谢谢
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define LL long long
int read() {
int x = 0;
int b = 1;
char c = getchar();
while(c > '9' || c < '0') {
if(c == '-') b = -1;
c = getchar();
}
while(c <= '9' && c >= '0') {
x = x * 10 + (c - '0');
c = getchar();
}
return x * b;
}
void write(int x) {
if(x < 0) x *= -1, putchar('-');
if(x > 9) write(x / 10);
putchar(x % 10 + '0');
}
int x;
int t;
int main()
{
x = read();
if(x == 0) {
t = read();
cout << t;
return 0;
}
for(int i = x; i >= 0; i --) {
t = read();
if(i == x) {
if(i == 1) {
if(t == 1) cout << "x";
else if(t == -1) cout << "-x";
else cout << t << "x";
}
else if(t != 0) {
if(t == 1) cout << "x^" << i;
else if(t == -1) cout << "-x^" << i;
else cout << t << "x^" << i;
}
continue;
}
if(i == 0) {
if(t > 0) cout << '+';
cout << t;
continue;
}
if(i == 1) {
if(t == 0) continue;
if(t > 0) cout << '+';
if(t == 1) cout << "x";
else if(t == -1) cout << "-x";
else cout << t << "x";
continue;
}
if(t != 0) {
if(t > 0) cout << '+';
if(t == 1) cout << "x^" << i;
else if(t == -1) cout << "-x^" << i;
else cout << t << "x^" << i;
}
}
return 0;
}