xah icon

Problem B: Geometric Progressions

xah | PRO | 11/23/21 07:00:36 AM UTC (Edited) | 0 ⭐ | 333 👁️ | Never ⏰ | []
Python |

440 B

|

None

|

0 👍

/

0 👎

n = int(input())
 
for nn in range(n):
    sample = input().split()
 
    sample = [int(s) for s in sample]
 
    ratio = sample[2] / sample[1]
    total = 1
    stuff = True
 
    for s in sample:
        if s == 1:
            continue
        else:
            total *= ratio
 
            if total != s:
                print('no')
                stuff = False
                break
 
    if stuff:
        print('yes', int(ratio))

Comments