题目链接:http://codeforces.com/gym/102219/problem/B
Time limit per test 1.0 s Memory limit per test 256 MB
Description
Sponge Bob, the famous cartoon character can only wear square shape pants. Squares shape can be described in geometry as having 4 right angles, just like rectangles. But a square is a special case of rectangle where its width and height are the same.
You are given the width and the height of a 4 right angled shape and need to figure out if it is a square or a rectangle for Sponge Bob. He will get all the square ones as his new pants for the coming Eidul Fitri.
Input
The first line contains T, the number of test cases. For each test case there is a line with two integers (1 ≤ w,h ≤ 1,000,000) representing width and height, respectively.
Output
For each test case, print one line consists of ′YES′ (without quotes) if the shape is a square and good for Sponge Bob's pants, otherwise print ′NO′ (without quotes) if it is a rectangle and not suitable to be Sponge Bob's pants.
Example
input
4
9 9
16 30
200 33
547 547
output
YES
NO
NO
YES
Problem solving report:
Description: 给你一个矩形的长和宽,判断是否为正方形。
Problem solving: 直接判断就行了。
Accepted Code:
/*
* @Author: lzyws739307453
* @Language: C++
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, w, h;
scanf("%d", &t);
while (t--) {
scanf("%d%d", &w, &h);
printf(w != h ? "NO\n" : "YES\n");
}
return 0;
}