D. Do it Right!
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Given two distinct positive integers A and B, find out if it is possible to find a third positive integer C so that a triangle with the sides ABand C is a right triangle. Remember that a triangle is called a right triangle if one of its angles equals to 90 degrees.

Input

The first line of input contains two positive integers A and B: the lengths of the two given sides (1 ≤ A < B ≤ 100).

Output

Output "YES" if it is possible to find such an integer C, or "NO" otherwise.

Sample test(s)
input
3 4
output
YES
input
1 2
output
NO
Note
  • In the first example, we can take C = 5.
  • In the second example, it is impossible to find an integer C with the required property.

题意:给a,b,找一个c是的a^2+b^2=c^2

分析:a,b如此小,为何不暴力?

 #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <deque>
#include <queue>
using namespace std;
typedef long long LL;
typedef double DB;
#define Rep(i, n) for(int i = (0); i < (n); i++)
#define Repn(i, n) for(int i = (n)-1; i >= 0; i--)
#define For(i, s, t) for(int i = (s); i <= (t); i++)
#define Ford(i, t, s) for(int i = (t); i >= (s); i--)
#define rep(i, s, t) for(int i = (s); i < (t); i++)
#define repn(i, s, t) for(int i = (s)-1; i >= (t); i--)
#define MIT (2147483647)
#define MLL (1000000000000000000LL)
#define INF (1000000001)
#define mk make_pair
#define ft first
#define sd second
#define clr(x, y) (memset(x, y, sizeof(x)))
#define sqr(x) ((x)*(x))
#define sz(x) ((int) (x).size())
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back template<class T>
inline T Getint()
{
char Ch = ' ';
T Ret = ;
while(!(Ch >= '' && Ch <= '')) Ch = getchar();
while(Ch >= '' && Ch <= '')
{
Ret = Ret * + Ch - '';
Ch = getchar();
}
return Ret;
} int a, b; inline void Input()
{
cin >> a >> b;
} inline int Sqr(int x)
{
return x * x;
} inline void Solve()
{
For(i, , )
{
int Arr[];
Arr[] = a * a;
Arr[] = b * b;
Arr[] = i * i;
sort(Arr, Arr + );
if(Arr[] + Arr[] == Arr[])
{
puts("YES");
return;
}
}
puts("NO");
} int main() {
Input();
Solve();
return ;
}

2014-2015 ACM-ICPC, NEERC, Moscow Subregional Contest D. Do it Right!的更多相关文章

  1. 2018-2019 ICPC, NEERC, Southern Subregional Contest

    目录 2018-2019 ICPC, NEERC, Southern Subregional Contest (Codeforces 1070) A.Find a Number(BFS) C.Clou ...

  2. Codeforces 2018-2019 ICPC, NEERC, Southern Subregional Contest

    2018-2019 ICPC, NEERC, Southern Subregional Contest 闲谈: 被操哥和男神带飞的一场ACM,第一把做了这么多题,荣幸成为7题队,虽然比赛的时候频频出锅 ...

  3. 2016 NEERC, Moscow Subregional Contest K. Knights of the Old Republic(Kruskal思想)

    2016 NEERC, Moscow Subregional Contest K. Knights of the Old Republic 题意:有一张图,第i个点被占领需要ai个兵,而每个兵传送至该 ...

  4. 2018-2019 ICPC, NEERC, Southern Subregional Contest (Online Mirror) Solution

    从这里开始 题目列表 瞎扯 Problem A Find a Number Problem B Berkomnadzor Problem C Cloud Computing Problem D Gar ...

  5. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem D. Distance 迪杰斯特拉

    Problem D. Distance 题目连接: http://codeforces.com/gym/100714 Description In a large city a cellular ne ...

  6. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem C. Contest 水题

    Problem C. Contest 题目连接: http://codeforces.com/gym/100714 Description The second round of the annual ...

  7. 2016-2017 ACM-ICPC, NEERC, Moscow Subregional Contest Problem L. Lazy Coordinator

    题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229511 时间限制:1s 空间限制:512MB 题目大意: 给定一个n 随后跟着2n行输入 ...

  8. Codeforces1070 2018-2019 ICPC, NEERC, Southern Subregional Contest (Online Mirror, ACM-ICPC Rules, Teams Preferred)总结

    第一次打ACM比赛,和yyf两个人一起搞事情 感觉被两个学长队暴打的好惨啊 然后我一直做傻子题,yyf一直在切神仙题 然后放一波题解(部分) A. Find a Number LINK 题目大意 给你 ...

  9. codeforce1070 2018-2019 ICPC, NEERC, Southern Subregional Contest (Online Mirror, ACM-ICPC Rules, Teams Preferred) 题解

    秉承ACM团队合作的思想懒,这篇blog只有部分题解,剩余的请前往星感大神Star_Feel的blog食用(表示男神汉克斯更懒不屑于写我们分别代写了下...) C. Cloud Computing 扫 ...

  10. 2016-2017 ACM-ICPC, NEERC, Moscow Subregional Contest

    A. Altitude 从小到大加入每个数,用set查找前驱和后继即可. 时间复杂度$O(n\log n)$. #include <bits/stdc++.h> using namespa ...

随机推荐

  1. JS_ECMA基本语法中的几种封装的小函数-1

    今天给大家介绍js ECMA中几个封装的小函数以及一些常用的函数小案例: 1,找重复的函数 <script> //在数组里面找重复: function findInArr(n,arr){ ...

  2. 环境搭建及wamp空密码修改

    WAMP:快速搭建PHP环境的.Windows系统下.搭建虚拟的服务器环境.APPSERVER:同上. LAMP架构Linux系统Apache服务器管理软件Mysql数据库Php语言. 修改密码方法: ...

  3. 按键消抖-----verilog

    实际系统中常用的按键大部分都是轻触式按键,如下图所示.该按键内部由一个弹簧片和两个固定触点组成,当弹簧片被按下,则两个固定触点接通,按键闭合.弹簧片松开,两个触点断开,按键也就断开了.根据这种按键的机 ...

  4. CLR via C#(10)-参数

    一. 命名参数.可选参数 命名参数和可选参数是在Visual C#2010中引入的新特性. 笨地儿我个瓜不兮兮的,今天才知道. 可选参数:定义方法时为参数设置默认值,调用该方法时可以省略为某些形参指定 ...

  5. SQLServer基本查询

    条件查询 --1.比较运算符 --2.确定集合谓词 --3.确定范围谓词 , ) --4.字符匹配谓词 select * from dbo.DepartMent where dName like 'C ...

  6. 【转载】Pyqt QSplitter分割窗口

    转载来自: http://blog.sina.com.cn/s/blog_4b5039210100h3ih.html 分割窗口在应用程序中经常用到,它可以灵活分布窗口布局,经常用于类似文件资源管理器的 ...

  7. 【转载】 JQuery.Gantt(甘特图) 开发指南

    转载来自: http://www.cnblogs.com/liusuqi/archive/2013/06/09/3129293.html JQuery.Gantt是一个开源的基于JQuery库的用于实 ...

  8. java-xml格式化

    参考:http://www.oschina.net/code/snippet_17793_4733 package com.ddatsh;   import java.io.IOException; ...

  9. ios 数据类型转换 UIImage转换为NSData NSData转换为NSString

    1.UIImage转换为NSData NSData *data;if (UIImagePNGRepresentation(image) == nil) { data = UIImageJPEGRepr ...

  10. 通信原理实践(四)——模拟通信系统性能分析

    一.模拟通信系统性能分析 1.系统框图 2.信噪比定义 (1)输入信噪比: (2)输出信噪比: (3)调制制度增益: 3.模拟通信系统分析等价模型 即自己产生一个高斯白噪声,加入到调制信号,然后在送入 ...