当前位置:网站首页>2019牛客暑期多校训练营(第七场)B-Irreducible Polynomial 【数论】
2019牛客暑期多校训练营(第七场)B-Irreducible Polynomial 【数论】
2022-07-21 10:03:00 【冰冷灬泡面】
2019牛客暑期多校训练营(第七场)B-Irreducible Polynomial 【数论】
题目:https://ac.nowcoder.com/acm/contest/887/B
大致题意:
给你一个数n,接下来给你n+1个数字(an,an-1……a0)表示这是一个n次多项式,ai表示第i次项前的系数。问你这个n次多项式是否能被因式分解。
思路:
签到题,然而我是真的菜,做不出来,其实就是一个很简单的数学知识:
实数域不可拆分多项式只有两种:一次多项式和二次的(b^2<4ac)
ok,直到了这个数学知识之后,秒过。
代码:
#include<bits/stdc++.h>
using namespace std;
int main() {
int cas;
scanf("%d",&cas);
while(cas--) {
int n, a[50];
scanf("%d",&n);
for(int i = 0; i <= n; i++) {
scanf("%d",&a[i]);
}
if(n == 1 || n == 0)
printf("Yes\n");
else if(n == 2) {
//b^2-4ac,判别式
int det = a[1] * a[1] - 4 * a[2] * a[0];
if(det < 0)
printf("Yes\n");
else
printf("No\n");
}
else
printf("No\n");
}
return 0;
}
边栏推荐
- 数据治理过程中会遇到那些数据问题?
- Qt|控制QScrollBar显示位置
- Airbnb 如何实现 Kubernetes 集群动态扩展
- SQL每日一练(牛客新题库)——第3天: 条件查询
- Leetcode 104. 二叉树的最大深度
- Chinese herbal medicine recognition based on deep neural network
- SVD singular value decomposition matrix compression
- MySQL performance optimization (II): select the optimized data type
- MySQL性能优化(二):选择优化的数据类型
- 小米12S Ultra产品力这么强老外却买不到 雷军:先专心做好中国市场
猜你喜欢
It takes only 10 pictures to figure out how the coupon architecture evolved!
QT | QT project documents Detailed explanation of pro file
有一说一,要搞明白优惠券架构是如何演化的,只需10张图!
云原生时代,开发者应具备这5大能力
Grafana visual configuration chart table
Kuberntes云原生实战一 高可用部署架构
基于JSP实现OA办公系统
Leetcode 104. 二叉树的最大深度
Force buckle 1260 2D mesh migration
Network layer protocol introduction
随机推荐
Product code update code
Two ways to implement topn with Flink application case statistics
70. 爬楼梯:假设你正在爬楼梯。需要 n 阶你才能到达楼顶。 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢?
SSL Error: Unable to verify the first certificate
Chapter 2 software process and thought section 1 Foundation
阿里云技术专家杨泽强:弹性计算云上可观测能力构建
Why does a very simple function crash
MySQL performance optimization (III): in depth understanding of indexing
Nature | 杨祎等揭示宿主内进化或可导致肠道共生菌致病
Alberl duilib入门及进阶教程
树莓派3B搭建Flink集群
SQL server数据库增量更新是根据 where 子句来识别的吗? 那做不到流更新吧? 每个表要
MySQL性能优化(二):选择优化的数据类型
In the cloud native era, developers should have these five capabilities
请教个问题 有没有用cdc监控oracle遇到Error Msg = ORA-04036: 实例使用
SQL daily practice (Niuke new question bank) - day 3: condition query
mysql.h: No such file or directory
hi和hello两个请求引发的@RequestBody思考
Leetcode 111. Minimum depth of binary tree
传输层协议