Run ID:163321

提交时间:2026-10-24 19:41:15

#include <iostream> using namespace std; bool is_leap(int y) { if (y % 400 == 0) return true; if (y % 100 == 0) return false; if (y % 4 == 0) return true; return false; } int main() { int T; cin >> T; while (T--) { int Y, N; cin >> Y >> N; int count = 0; int res; for (int y = Y; ; y++) { if (is_leap(y)) { count++; if (count == N) { res = y; break; } } } cout << res << endl; } return 0; }