#39201: OLE 多一個0

#### n12603579table@gmail.com (施智皓)

School : No School
ID : 145648
2024-04-04 21:19:31
c060. 00392 - Polynomial Showdown -- | From: [36.234.149.47] | Post Date : 2024-01-22 12:59

#include<iostream>
using namespace std;

int main(){

int arr[9]={0};

while(true){
if(cin.eof()) break;

for(int i=0;i<9;i++) cin>>arr[i];

int power=8;
for(int i=0;i<8;i++){
if(arr[i]==0);
cout<<" + ";
cout<<"x";
if(power != 1) cout<<"^"<<power;
}
cout<<"x";
if(power != 1) cout<<"^"<<power;
}
cout<<" - ";
cout<<"x";
if(power != 1) cout<<"^"<<power;
}
cout<<"-x";
if(power != 1) cout<<"^"<<power;
}
cout<<" + ";
cout<<arr[i]<<"x";
if(power != 1) cout<<"^"<<power;
}
cout<<" - ";
cout<<-arr[i]<<"x";
if(power != 1) cout<<"^"<<power;
}
cout<<arr[i]<<"x";
if(power != 1) cout<<"^"<<power;
}

power--;
}
cout<<" + "<<arr[8];
}
cout<<arr[8];
}
cout<<arr[8];
}
cout<<" - "<<-arr[8];
}

cout<<endl;
}

return 0;
}

#39202: Re: OLE 多一個0

#### liaoweichen1024@gmail.com (M_SQRT)

School : 新北市立新莊高級中學
ID : 195452
2024-06-18 13:25:26
c060. 00392 - Polynomial Showdown -- | From: [118.150.177.13] | Post Date : 2024-01-22 13:29

cin我不太會用，只能提供這個很蠢的改法

# include<iostream>using namespace std;int main() {    int arr[9] = {0};    while(cin>>arr[0]) {    // 把第一個數入放進判斷條件        for(int i=1; i<9; i++) cin>>arr[i];

#39203: Re: OLE 多一個0

#### n12603579table@gmail.com (施智皓)

School : No School
ID : 145648
2024-04-04 21:19:31
c060. 00392 - Polynomial Showdown -- | From: [36.234.149.47] | Post Date : 2024-01-22 14:10

cin我不太會用，只能提供這個很蠢的改法

# includeusing namespace std;int main() {    int arr[9] = {0};    while(cin>>arr[0]) {    // 把第一個數入放進判斷條件        for(int i=1; i<9; i++) cin>>arr[i];

btw 我也是第一天使用cin.eof() 所以很多東西要學習...

ZeroJudge Forum