Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
99224 陈志轩 多项式输出 C++ 解答错误 20 0 MS 252 KB 1159 2023-08-22 14:16:56

Tests(2/10):


#include<bits/stdc++.h> //#define int long long using namespace std; namespace Fast{ inline int fr(){ register int x = 0,f = 1; static char c = getchar(); while (c < '0' || c > '9'){ if (c == '-'){ f = -1; } c = getchar(); } while (c >= '0' && c <= '9'){ x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); } return x * f; } inline void fw(int x){ if (x < 0){ x = -x; putchar('-'); } if (x > 9){ fw(x / 10); } putchar(x % 10 + 48); } } using namespace Fast; char c[5] = {'+','-'}; signed main(){ int n = fr(),o,x = 0; o = n; for (int i = 1;i <= n + 1;i++){ int a = fr(); if (o == 0 && a != 0){ x = (a < 0); cout<<c[x]<<a; continue; } if (a == 0){ o--; continue; } else if (a == 1){ x = 0; if (i >= 2){ cout<<c[x]; } cout<<"x^"<<o; } else if (a == -1){ x = 1; if (i >= 2){ cout<<c[x]; } cout<<"x^"<<o; } else{ x = (a < 0); if (i >= 2){ cout<<c[x]; } if (i == 1 && a < 0){ cout<<'-'; } cout<<abs(a)<<"x^"<<o; } o--; } return 0; }


测评信息: