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 标签: 数学问题-博弈论 ...
随机推荐
- Chart.js | HTML5 Charts for your website.
Chart.js | HTML5 Charts for your website. Chart.js
- #292 (div.2) D.Drazil and Tiles (贪心+bfs)
Description Drazil created a following problem about putting × tiles into an n × m grid: "The ...
- catkin_simple 的使用
Catkin simple 可用于规范catkin package, 并简化CMakeLists Dependencies are just listed once as build-depend ...
- IOS添加多个按钮在导航栏
UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 75.0f, 30.0f)]; UIButton * ...
- Beauty of Array(模拟)
M - M Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit Status P ...
- Memcached安装,操作,用C#操作
本文来自:http://li19910722.blog.163.com/blog/static/136856822201406103313163/ 1:安装 下载Memcache:http://cod ...
- atitit.导出excel的设计----查询结果 导出为excel的实现java .net php 总结
atitit.导出excel的设计----查询结果 导出为excel的实现java .net php 总结 1. 基本的流程 查询获得list 读取jsp的table获得标题and 字段的map to ...
- with ffmpeg to encode video for live streaming and for recording to files for on-demand playback
We've been doing some experimentation with ffmpeg to encode video for live streaming and for recordi ...
- JavaScript关闭浏览器
(*^__^*) 嘻嘻……,以前我找关闭浏览器选项卡的代码找不到,我还以为要用后台代码关呢?今天发现只要简单2句JavaScipt代码就可以了.看来很多东西还是在于平时的积累啊的说! 模仿延儿的口气了 ...
- achartengine 实现平行线 动态数据 x轴动态移动
achartengine做平行线的时候经常会遇到: java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1 at java.ut ...