#include<iostream> using namespace std; bool is_leap(int year){ if((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)){ return true; }else{ return false; } } int main(){ int m; int year, n; int count; cin>>m; for(int i = 0; i < m; i++){ count = 0; cin>>year>>n; for( ; count < n; year++){//注意这里是 count < n,而不是 count <= n if(is_leap(year)){ count++; } } year--; cout<<year<<endl; } }