'commit'
This commit is contained in:
38
TangDou/LuoGuBook/第8章模拟与高精度/TD.cpp
Normal file
38
TangDou/LuoGuBook/第8章模拟与高精度/TD.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user