Run ID:118265

提交时间:2025-04-26 14:43:30

#include <iostream> using namespace std; bool isLeapYear(int year) { if (year % 400 == 0) return true; if (year % 100 == 0) return false; if (year % 4 == 0) return true; return false; } int findNthLeapYear(int Y, int N) { int count = 0; int currentYear = Y; while (count < N) { if (isLeapYear(currentYear)) { count++; } currentYear++; } return currentYear - 1; } int main() { int T; cin >> T; while (T--) { int Y, N; cin >> Y >> N; cout << findNthLeapYear(Y, N) << endl; } return 0; }