额,你的程序我看不懂 @ 周靖轶 ,但是你看一下,好像指数为1时,要输出a[i]x,例如a[i]的指数为1时,a[i]为1时,好像要输出1x,你可以试一下。
by Sirius_X @ 2017-08-15 12:37:34
表示我也60分
by 裴清 @ 2017-08-21 12:11:44
你的代码我也看不懂,浅看一下我的吧!
```
#include <cstring>
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n,a[100];
cin>>n;
for(int i=n;i>=0;i--)
cin>>a[i];
for(int i=n;i>=0;i--){
if(a[i]!=0){
if(a[i]>=1){
if(i!=n)
cout<<"+";
}else
cout<<"-";
if(abs(a[i])>1||i==0)
cout<<abs(a[i]);
if(i>0)
cout<<"x";
if(i>1)
cout<<"^"<<i;
}
}
return 0;
}
```
by gbx123 @ 2022-09-25 20:17:16