ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);✨✨✨✨✨✨✨✨✨✨
互关条件
- AC:Accept,垃圾程序。
- CE:Compile Error,编译正确。
- PC:Partially Correct,部分正确。
- WA:Wrong Answer,答案全部正确。
- RE:Runtime Error,运行没问题。
- TLE:Time Limit Exceeded,没有超出时间限制。
- MLE:Memory Limit Exceeded,没有超出内存限制。
- OLE:Output Limit Exceeded,输出没超过限制。
- UKE:Unknown Error,做的太棒了!!!
羞日遮罗袖,愁春懒起妆。
易求无价宝,难得有心郎。
枕上潜垂泪,花间暗断肠。
自能窥宋玉,何必恨王昌。
团队网址1
团队网址2
加个团吧,求求了~
#include<bits/stdc++.h>
using namespace std;
const int N = 110;
int a[N];
int n;
int main(){
cin >> n;
for(int i = n; i >= 0; i--)
cin >> a[i];
for(int i = n; i >= 0; i--){
if(a[i] == 0)
continue;
else if(a[i] == 1){
if(i == 1)
cout << "+x";
else{
if(i != n && i > 0)
cout << "+x^" << i;
if(i == n && i != 0)
cout << "x^" << i;
if(i == 0 && i != n )
cout << "+" << a[i];
if(i == 0 && i == n)
cout << a[i];
}
}
else if(a[i] == -1){
if(i == 1)
cout << "-x";
else if(i == 0)
cout << a[i];
else
cout << "-x^" << i;
}
else{
if(a[i] > 0)
if(i != n) cout << "+";
if(i >= 2) cout << a[i] << "x^" << i;
if(i == 1) cout << a[i] << "x";
if(i == 0) cout << a[i];
}
}
return 0;
}







