自己感觉没问题
by goldcookfzy @ 2022-03-22 12:31:17
前面两个i里面的n==0和n==1改了吧 马蜂跟我的不太匹配就帮到这吧...
by L_cm_C5H6 @ 2022-03-22 13:36:17
@[L_cm_C5H6](/user/429699) 我试试
by goldcookfzy @ 2022-03-23 12:34:48
神贴留名
by _落谷 @ 2022-03-27 15:17:12
一目80行
by goldcookfzy @ 2022-03-27 15:17:37
@[goldcookfzy](/user/496669)
这是我的:
```cpp
#include <iostream>
using namespace std;
int n, t, m;
int main(){
cin >> m;
n = m;
if(n == 0){
cout << "0" << endl;
return 0;
}
while(n != -1){
cin >> t;
if(n == 0){
if(t > 0){
cout << "+" << t;
} else if(t < 0){
cout << t;
}
} else {
if(n == m){
if(t > 0){
if(t == 1){
if(n != 1) cout << "x^" << n;
else cout << "x";
} else {
if(n != 1) cout << t << "x^" << n;
else cout << t << "x";
}
} else if(t < 0){
if(t == -1){
if(n != 1) cout << "-x^" << n;
else cout << "-x";
} else {
if(n != 1) cout << t << "x^" << n;
else cout << "t" << "x";
}
}
} else {
if(t > 0){
if(t == 1){
if(n != 1) cout << "+x^" << n;
else cout << "+x";
} else {
if(n != 1) cout << "+" << t << "x^" << n;
else cout << "+" << t << "x";
}
} else if(t < 0){
if(t == -1){
if(n != 1) cout << "-x^" << n;
else cout << "-x";
} else {
if(n != 1) cout << t << "x^" << n;
else cout << t << "x";
}
}
}
}
n--;
}
return 0;
}
```
by achjuncool @ 2022-06-27 21:39:22