Mo the pro does not want to be late for the promo of Incident'14, the annual cultural…
- User
Mo the pro does not want to be late for the promo of Incident'14, the annual cultural fest of NITK. In his excitement, he drops his only 2 wrist watches. He sets his watches according to a wall clock. After some time N he discovers that one of the watch is X minutes fast, and the other watch is Y minutes slow. What is the minimum time(in minutes) after which both the watches show the same time ? Input The first line of the input is T the number of test cases. Each line of the test case contains 3 integers N,X,Y.
Output Output the smallest time in minutes(output the integer only) after which the 2 watches will show the same time.
Constraints
1 ≤ T ≤ 100 0 < N ≤ 1440 0 ≤ X,Y ≤ 60
Example Input: 2 10 5 5 1 1 1
Output: 720 360
Assistant
pythonimport math T = int(input()) for _ in range(T): N, X, Y = map(int, input().split()) sum_xy = X + Y if sum_xy == 0: print(0) else: product = 720 * N g = math.gcd(product, sum_xy) t = product // g print(t)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.