hdu 5615 (Jam's math problem)
来源:互联网 发布:暴风vr电视直播软件 编辑:程序博客网 时间:2024/06/06 16:31
数学 Jam's math problem
Description
Jam has a math problem. He just learned factorization.
He is trying to factorize $ax^2+bx+c$ into the form of $pqx^2+(qk+mp)x+km=(px+k)(qx+m)$.
He could only solve the problem in which p,q,m,k are positive numbers.
Please help him determine whether the expression could be factorized with p,q,m,k being postive.
He is trying to factorize $ax^2+bx+c$ into the form of $pqx^2+(qk+mp)x+km=(px+k)(qx+m)$.
He could only solve the problem in which p,q,m,k are positive numbers.
Please help him determine whether the expression could be factorized with p,q,m,k being postive.
Input
The first line is a number $T$, means there are $T(1 \leq T \leq 100 )$ cases
Each case has one line,the line has $3$ numbers $a,b,c (1 \leq a,b,c \leq 100000000)$
Each case has one line,the line has $3$ numbers $a,b,c (1 \leq a,b,c \leq 100000000)$
Output
You should output the "YES" or "NO".
Sample Input
21 6 51 6 4
Sample Output
YESNO
题意:ax^2+bx+c能否转化成十字相乘的形式((pm+kq=b))
题解:若能转化,则x必为有理数,求根公式 x=(-b±√△)/2a,判断 △是否为完全平方数。
<span style="font-size:18px;">#include<cstdio>#include<cmath>using namespace std;int main(){int t;long long a,b,c;scanf ("%d",&t);while (t--){scanf ("%lld %lld %lld",&a,&b,&c);long long m=b*b-4*a*c;long long k=sqrt(m);if (k*k==m)printf ("YES\n");elseprintf ("NO\n");}return 0;} </span>
0 0
- HDU 5615 Jam's math problem
- HDU 5615 Jam's math problem
- HDU 5615 Jam's math problem
- hdu 5615 Jam's math problem
- HDU-5615-Jam's math problem
- Hdu 5615 Jam's math problem【数学】
- hdu 5615 Jam's math problem
- HDU 5615:Jam's math problem【模拟】
- HDU 5615 Jam's math problem
- HDU 5615 Jam's math problem <数学>
- hdu 5615 (Jam's math problem)
- HDU Problem 5615 Jam's math problem 【十字交叉,暴力】
- 杭电hdu 5615 Jam's math problem【胡搞过】
- HDU 5615 Jam's math problem(模拟)
- HDU-5615(Jam's math problem)(方程求解)
- HDU 5615 Jam's math problem(十字相乘判定)
- HDU:5615 Jam's math problem(暴力,数学)
- HDU 5615 Jam's math problem(水~)
- PHP函数之error_reporting
- CF703D. Mishka and Interesting sum
- EventBus3.0,使用过程中所有的梗。
- 区分使用Axis2和CXF的wsdl2java命令
- Mysql CPU占用高的问题解决方法小结
- hdu 5615 (Jam's math problem)
- 手机号码正则表达式js校验
- Android手机悬浮窗口小例子
- ios关于用xib创建的cell 自动返回cell的高度问题
- Creating JSON from Java
- 关于通过JAVA的HTTP POST请求传输XML型数据
- 反射型XSS 之 防范
- 11、canvas标签之绘制文本
- Python学习之seek函数