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;
}
全部评论

相关推荐

湫湫湫不会java:1.在校经历全删了2.。这些荣誉其实也没啥用只能说,要的是好的开发者不是好好学生3.项目五六点就行了,一个亮点一俩行,xxx技术解决,xxx问题带来xxx提升。第一页学历不行,然后啥有价值的信息也没有,到第二页看到项目了,第一个项目九点,第二个项目像凑数的俩点。总体给人又臭又长,一起加油吧兄弟
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务