Relativity Codechef Solution
In Chefland, the speed of light is c m/sc m/s, and acceleration due to gravity is g m/s2g m/s2.
Find the smallest height (in meters) from which Chef should jump such that during his journey down only under the effect of gravity and independent of any air resistance, he achieves the speed of light and verifies Einstein’s theory of special relativity.
Assume he jumps at zero velocity and at any time, his velocity (vv) and depth of descent (HH) are related asv2=2⋅g⋅H.v2=2⋅g⋅H.
See Also : July Long Challenge 2021 Solutions Codechef
- The first line contains an integer TT, the number of test cases. Then the test cases follow.
- Each test case contains a single line of input, two integers gg, cc.
For each test case, output in a single line the answer to the problem. We can show that under the constraints, the answer is an integer.
- 2⋅g2⋅g divides c2c2.
Subtask #1 (100 points): Original constraints
3 7 1400 5 1000 10 1000
140000 100000 50000
Test Case 11: For Chef to achieve the speed of light, the minimum height required is c22⋅gc22⋅g = 1400⋅1400141400⋅140014 = 140000140000 meters.
Test Case 33: For Chef to achieve the speed of light, the minimum height required is c22⋅gc22⋅g = 1000⋅1000201000⋅100020 = 5000050000 meters.
# cook your dish here t=int(input()) for i in range(t): g,c=map(int,input().split()) res=((c*c)//(2*g)) print(res)
July Long Challenge 2021 Solutions
- Maximum Production
- Optimal Denomination
- K Path Query
- Chef vs Bharat
- Chef and Pairs
- Even Odd Partition
- Dakimakura Distribition
- Madoka and Ladder Decomposition
Weekly Contest 247
- Maximum Product Difference Between Two Pairs
- Cyclically Rotating a Grid
- Number of Wonderful Substrings
- Count Ways to Build Rooms in an Ant Colony