Run ID:124059

提交时间:2025-07-10 21:46:43

def is_leap(year): if year % 4 != 0: return False elif year % 100 != 0: return True else: return year % 400 == 0 def find_nth_leap(Y, N): count = 0 current_year = Y while count < N: if is_leap(current_year): count += 1 if count == N: return current_year current_year += 1 return current_year - 1 T = int(input()) for _ in range(T): Y, N = map(int, input().split()) print(find_nth_leap(Y, N))