Existence Code chef.

Posted on | Saturday, 20 May 2023 | No Comments

 

Problem

Chef has two variables  and . He wants to find out whether the variables satisfy the equation:

  • 4+42=42

Input Format

  • The first line of input will contain a single integer , denoting the number of test cases.
  • Each test case consists of two integers  and , as mentioned in statement.

Output Format

For each test case, output YES if the variables  and  satisfy the given equation, NO otherwise.

You may print each character in uppercase or lowercase. For example, YesYESyes, and YeS are all considered the same.

Constraints

  • 11000
  • 1109
  • 11018

Sample 1:

Input
Output
5
2 2
4 4
3 6
8 32
200000000 20000000000000000
YES
NO
NO
YES
YES

Explanation:

Test case 1: Given =2 and =2. Here, 24+422=4222=32.

Test case 2: Given =4 and =4. Here, 44+442=320 which is not equal to 4424=256.

Test case 3: Given =3 and =6. Here, 34+462=225 which is not equal to 4326=216.

Test case 4: Given =8 and =32. Here, 84+4322=8192 which is equal to 48232=8192.

Test case 5: Given =2108 and =21016. Here, (2108)4+4(21016)2=321032 which is equal to 4(2108)2(21016)=321032.

code

for i in range(int(input())):

    a,b=map(int,input().split())

    if (a**4)+4*b**2==4*a**2*b:

        print("YES")

    else:

        print("NO")

Comments

Leave a Reply

Search

Followers