BestCoder Round #70 1001 Jam's math problem
来源:互联网 发布:2017淘宝双11实时 编辑:程序博客网 时间:2024/05/20 19:29
思路:a,b,c都是10^9,直接相乘会爆int,直接判sqrt(b^2-4ac)是不是为大于等于0的整数即可
#include <cstdio>#include <queue>#include <cstring>#include <iostream>#include <cstdlib>#include <algorithm>#include <vector>#include <map>#include <string>#include <set>#include <ctime>#include <cmath>#include <cctype>using namespace std;#define maxn 100000#define LL long longint cas=1,T;int main(){//freopen("in","r",stdin);scanf("%d",&T);while (T--){LL a,b,c;double ans = 0;scanf("%I64d%I64d%I64d",&a,&b,&c); LL delta = b*b - 4 * a*c;LL k = 0;bool ok = 1;while ((k+1)*(k+1) <=delta)++k;ok = delta>=0 && k*k==delta;puts(ok?"YES":"NO");}//printf("time=%.3lf",(double)clock()/CLOCKS_PER_SEC);return 0;}
问题描述
Jam有道数学题想向你请教一下,他刚刚学会因式分解比如说,x2+6x+5=(x+1)(x+5)就好像形如 ax2+bx+c => pqx2+(qk+mp)x+km=(px+k)(qx+m)但是他很蠢,他只会做p,q,m,k为正整数的题目请你帮助他,问可不可以分解
输入描述
第一行T,表示T(1≤T≤100)组数据。接下来T组数据:每组数据一行,一个三个整数a,b,c,一组数据一行 (1≤a,b,c≤100000000)
输出描述
对于每组数据,输出"YES"或者"NO".
输入样例
21 6 51 6 4
输出样例
YESNO
Hint
第一组数据可以分成(x+1)(x+5)=x2+6∗x+5
0 0
- BestCoder Round #70 1001 Jam's math problem
- hdu5615 Jam's math problem (BestCoder Round #70)
- hdu5618 Jam's problem again(cdq分治)(BestCoder Round #70)
- BestCoder Round #29 1001GTY's math problem
- BestCoder Round#29 1001 GTY's math problem
- Jam's math problem
- Jam's math problem
- HDU5615:Jam's math problem
- hdu5616 Jam's math problem
- Jam's math problem<hdoj5615>
- I - Jam's math problem
- HDU5615 Jam's math problem
- GTY's math problem (BestCoder Round #29 A)
- BestCoder Round #70 1002 Jam's balance(DP)
- BestCoder Round #70 Jam's store(网络流)
- hdu 5617 Jam's maze(dp)(BestCoder Round #70)
- HDOJ 5615 Jam's math problem
- HDOJ 5615-Jam's math problem【数学】
- springmvc(九) 参数绑定
- 机房收费系统重构之七层系统登录
- linux 无线网卡配置
- 学习总结
- HttpServlet 类解析
- BestCoder Round #70 1001 Jam's math problem
- hdu 2095 非异或 代码
- 网页鼠标滚轮事件(滚滚屏)的获取及理解
- 关于使用smack4.x 在android平台开发时的jar包问题小结
- 240,eclipse快捷键
- 正则表达式
- 1.JDBC连接数据库
- 关于异常处理
- JDBC利用Statement接口实现增删改操作