Jam's math problem(思维)
Description





































Input











Each case has one line,the line has

























Output
Sample Input
1 6 5
1 6 4
Sample Output
NO
Hint
- The first case turn $x^2+6*x+5$ into $(x+1)(x+5)$
- #include<iostream>
- #include<cstdio>
- #include<cmath>
- #include<algorithm>
- #include<cstring>
- #include<vector>
- #include<map>
- #include<string>
- using namespace std;
- typedef long long LL;
- /*
- const int MAXN=1e5+100;
- map<string,bool>mp;
- char* tostring(LL x){
- char s[12];
- int tp=0;
- while(x){
- s[tp++]=x%10+'0';
- x/=10;
- }
- s[tp]='\0';
- reverse(s,s+tp);
- return s;
- }
- void db(){
- mp.clear();
- for(int i=2;i<100000;i++){
- if(!mp[tostring(i)])
- for(LL j=(LL)i*i;j<=(LL)3000000000;j+=i){
- mp[tostring(j)]=true;
- }
- }
- }
- int main(){
- int T,a,b,c;
- scanf("%d",&T);
- db();
- while(T--){
- scanf("%d%d%d",&a,&b,&c);
- if(a+b+c<4){
- puts("NO");continue;
- }
- if(mp[tostring((LL)a+b+c)])puts("YES");
- else puts("NO");
- }
- return 0;
- }
- */
- int main(){
- LL a,b,c,p,q,m,k;
- int T;
- cin>>T;
- while(T--){
- cin>>a>>b>>c;
- bool ans=false;
- for(int p=;p*p<=a;p++){
- if(a%p==){
- q=a/p;
- for(int k=;k*k<=c;k++){
- if(c%k==){
- m=c/k;
- if(q*k+m*p==b||p*k+m*q==b)ans=true;
- }
- if(ans)break;
- }
- }
- if(ans)break;
- }
- if(ans)puts("YES");
- else puts("NO");
- }
- return ;
- }
Jam's math problem(思维)的更多相关文章
- HDU 5615 Jam's math problem
Jam's math problem Problem Description Jam has a math problem. He just learned factorization.He is t ...
- BestCoder Round #70 Jam's math problem(hdu 5615)
Problem Description Jam has a math problem. He just learned factorization. He is trying to factorize ...
- hdu 5615 Jam's math problem(十字相乘判定)
d. Jam有道数学题想向你请教一下,他刚刚学会因式分解比如说,x^2+6x+5=(x+1)(x+5) 就好像形如 ax^2+bx+c => pqx^2+(qk+mp)x+km=(px+k)(q ...
- hdu 5615 Jam's math problem(判断是否能合并多项式)
方法一:由十字相乘相关理论我们能知道,如果要有p,k,q,m,那么首先要有解,所以b*b-4*a*c要>0,然而因为p,k,q,m是正整数,所以代表x1,x2都是有理数,有理数是什么鬼呢?就是解 ...
- hdu 1757 A Simple Math Problem (乘法矩阵)
A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- HDU1757 A Simple Math Problem 矩阵快速幂
A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- hdu----(5055)Bob and math problem(贪心)
Bob and math problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Oth ...
- hdu------(1757)A Simple Math Problem(简单矩阵快速幂)
A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- FZYZ-2071 A Simple Math Problem IX
P2071 -- A Simple Math Problem IX 时间限制:1000MS 内存限制:262144KB 状态:Accepted 标签: 数学问题-博弈论 ...
随机推荐
- LeeCode-Invert Binary Tree
Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 /** * Definition for a ...
- SQL With(递归 CTE 查询)
本文来自:http://www.cnblogs.com/smailxiaobai/archive/2012/01/16/2323291.html 指定临时命名的结果集,这些结果集称为公用表表达式 (C ...
- ubuntu 步步为营之uclinux编译和移植(完整版)
本节主要包含(ubuntu10.04) 一,linux下的经常使用压缩解压缩命令 二,环境建立 三,内核编译 四,移植 一,linux下的经常使用压缩解压缩命令 在linux下常见的压缩文件格式有ta ...
- Android设备定制为永不锁屏
Android系统的锁屏时间存放在Setting数据库中,字段为Settings.System.SCREEN_OFF_TIMEOUT.查看 DatabaseHelper.java文件可以找到: fra ...
- 9.5 在 C# 中使用 F# 库
9.5 在 C# 中使用 F# 库 像 C# 一样,F# 也是一种静态类型的语言,就是说,编译器知道每一个值的类型,以及类方法和属性的签名.对于与 C# 的互操作性来说.这是很重要的,由于,编译器能够 ...
- 有关Oracle cvu和cvuqdisk
有关Oracle cvu和cvuqdisk cvu的下载链接: http://www.oracle.com/technetwork/products/clustering/downloads/cvu- ...
- C# 热水器
需求分析:现在有一个烧水器假设水温升高到100度为开水请用设计程序模拟整个烧水的过程,打开热水器,当水温达到95度时报警器开始发出警报,水温达到100度时,断开热水器电源. 我们使用常规的思维去分析这 ...
- Starting httpd:Could not reliably determine the server's fully qualified domain name
#service httpd start #Starting httpd: httpd: Could not reliably determine the server's fully qualifi ...
- C# 限制Text只能输入数字
private void InputNumber(KeyPressEventArgs e) { //如果输入的不是数字键,也不是回车键.Backspace键,则取消该输入 && e.K ...
- WEB标准:标准定义、好处、名词解释、常用术语、命名习惯、浏览器兼容、代码书写规范
1. WEB标准是什么? “WEB标准”是一系列标准的总称.一般的误区经常把WEB标准说成DIV+CSS.准确的说法应该是:采用W3C推荐的WEB标准中的XHTML1.1结合CSS2.0 样式表制作页 ...