Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
163321 金浩宸 过生日 C++ Accepted 1 MS 268 KB 672 2026-10-24 19:41:15

Tests(1/1):


Code:

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