Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
118265 彭士宝 过生日 C++ Accepted 2 MS 268 KB 634 2025-04-26 14:43:30

Tests(1/1):


Code:

#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; }