30pts求助

P1067 [NOIP2009 普及组] 多项式输出

其实。。。很简单。。。 ```c #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = n; i >= 0; i--) { int a; cin >> a; if (a != 0) { if (i != n && a > 0) cout << "+"; if (abs(a) > 1 || i == 0) cout << a; if (a == -1 && i) cout << "-"; if (i != 1 && i != 0) cout << "x^" << i; if (i == 1) cout << "x"; } } return 0; } ``` 对,完事儿了。。。
by wzj0829 @ 2023-08-23 21:42:49


@[wzj0829](/user/1028403) 谢谢
by YuanHaoYu6315 @ 2023-08-25 13:01:42


|