有多行,每行两个整数N(10<=N<=50), K(1<=K<=20)
针对每组数据,如果在第21年或者之前就能买下这套房子,则输出一个整数M,表示最早需要在第M年能买下,否则输出Impossible,输出需要换行
50 10 40 10 40 8
8 Impossible 10
def buyhoues(n, k): price = 200 flag = 0 for i in range(1, 24): if i == 1: continue else: price = price * (1 + k / 100) s = n*i if price <= s and i < 21: flag = 1 break if flag == 1: print(i) else: print('Impossible') while True: try: N, K = map(int, input().split()) buyhoues(N, K) except: break