SOS
查看原帖
SOS
716488
a_study_xxs楼主2023/6/30 09:35
#include<iostream>
using namespace std;
int n , a[1005] ;
int main(){
    cin >> n ;
    for(int i = 1 ; i <= n + 1; i ++) cin >> a[i] ;
    for(int i = n ; i >= 0 ; i --){
        if(a[i - 1] == 0) continue ;
        string s = to_string(a[i + 1]) ;
        if((s[0] == '-' && s[1] == '1')|| s[0] == '1') cout << "x^" << i ;
        else cout << a[i] << "x^" << i ;
    }
}
2023/6/30 09:35
加载中...