Kepler's Law Code Chef

Posted on | Saturday 20 May 2023 | No Comments

 

Problem

Kepler’s Law states that the planets move around the sun in elliptical orbits with the sun at one focus. Kepler's 3rd law is The Law of Periods, according to which:

  • The square of the time period of the planet is directly proportional to the cube of the semimajor axis of its orbit.

You are given the Time periods (1,2) and Semimajor Axes (1,2) of two planets orbiting the same star.

Please determine if the Law of Periods is satisfied or not, i.e, if the constant of proportionality of both planets is the same.

Print "Yes" (without quotes) if the law is satisfied, else print "No".

Input Format

  • The first line of input contains a single integer , denoting the number of test cases. The description of  test cases follows.
  • Each test case consists a single line of input, containing four space-separated integers 1,2,1,2.

Output Format

For each test case, output a single line containing one string — "Yes" or "No" (without quotes); the answer to the problem.

You may print each character of the answer in uppercase or lowercase (for example, the strings "yEs", "yes", "Yes" and "YES" will all be treated as identical).

Constraints

  • 1104
  • 11,210
  • 11,210

Subtasks

Subtask 1(100 points): Original constraints

Sample 1:

Input
Output
3
1 1 1 1
1 2 3 4
1 8 2 8
Yes
No
Yes
  • CODE
for i in range(int(input())):
    a,b,c,d=map(int,input().split())
    if a**2/c**3==b**2/d**3:
        print("YES")
    else:
        print("NO")

Search

Followers