帮帮蒟蒻罢(悲)
#include<bits/stdc++.h>
using namespace std;
long long x,y[1000009],cnt=0,pd0=0;
string k;
int main(){
cin>>x;
cnt=x;
for(int i=0;i<=x;i++){
cin>>y[i];
}
for(int i=0;i<=x;i++){
if(y[i]==0){
cnt--;
continue;
}
if(cnt!=x and y[i]>0){
cout<<"+";
}
if(cnt==0){
cout<<y[i];
}
else if(y[i]>0){
if(y[i]==1 and cnt!=1){
cout<<"x"<<"^"<<cnt;
}
else if(y[i]==1 and cnt==1){
cout<<"x";
}
else{
cout<<y[i];
cout<<"x"<<"^"<<cnt;
}
}
else if(y[i]<0){
if(y[i]==-1 and cnt!=1){
cout<<"-"<<"x"<<"^"<<cnt;
}
else if(y[i]==-1 and cnt==1){
cout<<"-x";
}
else{
cout<<y[i];
cout<<"x"<<"^"<<cnt;
}
}
cnt--;
}
return 0;
}