2019牛客多校第七场B题
B-Irreducible Polynomial_2019牛客暑期多校训练营(第七场)
https://ac.nowcoder.com/acm/contest/887/B
本题问你能否将一个已知系数的多项式因式分解,我们只要知道一个性质就ok;
一个多项式不可分解,当且仅当它次数为1或者次数为2但判别式小于零。由此可知:
#include<cstdio> #include <algorithm> #include <iostream> #include <memory.h> #include <queue> #define rep(i, n) for(int i=0;i<n;i++) #define per(i, n) for(int i=n;i>=1;i--) #define pb(x) push_back(x) #define clint(x, n) memset(x,n,sizeof(x)) typedef long long ll; const int maxn = 25; const ll inf = 99999999; using namespace std; int dirx[] = {1, 0, -1, 0, 0, 0}; int diry[] = {0, 1, 0, -1, 0, 0}; int dirz[] = {0, 0, 0, 0, 1, -1}; int px, py, pz; int m, n, T, t; char ma[30][30][30]; int vis[30][30][30]; int ans; int ex, ey, ez; char ss[10]; string str; int a[1010]; int main() { int t; scanf("%d",&t); while(t--) { int n; while (~scanf("%d", &n)) { for (int i = n; i >= 0; i--) scanf("%d", &a[i]); if (n < 2) cout << "Yes" << endl; else if (n == 2) { if ((a[1] * a[1]) >= 4 * a[2] * a[0]) cout << "No" << endl; else cout << "Yes" << endl; } else { cout << "No" << endl; } } } return 0; }