You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
793 B
38 lines
793 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
const int INF = 0x3f3f3f3f;
|
|
typedef long long LL;
|
|
/*
|
|
5
|
|
100 -1 1 -3 0 10
|
|
|
|
100x^5-x^4+x^3-3x^2+10
|
|
*/
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
for (int i = 1; i <= n + 1; i++) {
|
|
int a;
|
|
cin >> a;
|
|
if (a == 1) {
|
|
if (i == 1)
|
|
cout << "x^" << n - i + 1;
|
|
else
|
|
cout << "+x^" << n - i + 1;
|
|
}
|
|
|
|
else if (a == -1)
|
|
cout << "-"
|
|
<< "x^" << n - i + 1;
|
|
else if (a > 0) {
|
|
if (i == 1)
|
|
cout << a << "x^" << n - i + 1;
|
|
else
|
|
cout << "+" << a << "x^" << n - i + 1;
|
|
} else
|
|
cout << a << "x" << n - i + 1;
|
|
}
|
|
|
|
return 0;
|
|
} |