悬棺,求调
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
cin>>a;
for(int i=a;i>=0;i--){
cin>>b;
if(b!=0){
if(i>1){
if(b<0&&b!=-1)cout<<b<<"x^"<<i;
else if(b==-1)cout<<"-x^"<<i;
else if(b==1&&i!=a)cout<<"+x^"<<i;
else if(b==1&&i==a)cout<<"x^"<<i;
else if(i!=a)cout<<'+'<<b<<"x^"<<i;
else cout<<b<<"x^"<<i;
}
else if(i==1){
if(b<0&&b!=-1)cout<<b<<"x";
else if(b==-1)cout<<"-x";
else if(b==1)cout<<"+x";
else cout<<'+'<<b<<"x^";
}
else {
if(b<0)cout<<b;
else cout<<"+"<<b;
}
}
}
return 0;}