提交时间:2023-08-22 16:50:24
运行 ID: 99411
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; bool first = true; for (int i = n; i >= 0; i--) { int x; cin >> x; if (x == 0) continue; if (!first && x >= 1) cout << "+"; first = false; if (x == -1) cout << "-"; if (abs(x) != 1 || i == 0) cout << x; if (i != 0) cout << "x^" << i; } return 0; }