1 solutions
-
0
#include<bits/stdc++.h> using namespace std; const int N=2e5+10; int n,a[N],pre[N]; int main(){ int t,x; cin>>t; bool flag=0; for(int i=0;i<=t;i++){ cin>>x; if(!x) continue; if(!flag){ if(x<0) cout<<"-"; if(abs(x)!=1) cout<<abs(x); int tt=t-i; if(tt==1) cout<<"x"; else if(tt)cout<<"x"<<"^"<<tt; flag=1; } else{ if(x>0) cout<<"+"; else cout<<"-"; if(abs(x)!=1) cout<<abs(x); int tt=t-i; if(tt==1) cout<<"x"; else if(tt)cout<<"x"<<"^"<<tt; } } }
Information
- ID
- 6627
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 5
- Tags
- # Submissions
- 79
- Accepted
- 22
- Uploaded By