现在的位置: 首页 > 综合 > 正文

hdu 1076 水

2018年04月23日 ⁄ 综合 ⁄ 共 259字 ⁄ 字号 评论关闭
#include<cstdio>
#include<iostream>

bool isleap(int x){
     return (x%4 == 0 && x%100 !=0) || x%400 == 0;
}

int main(void){
    int t;
    scanf("%d",&t);
    while(t--){
        int n,m,count=0;;
        scanf("%d%d",&n,&m);
        while(1){
            if(isleap(n)){
              count++;
              if(count == m){
                printf("%d\n",n);
                break;
              }
            }
            n+=4-(n%4);
        }
    }
    return 0;
}

【上篇】
【下篇】

抱歉!评论已关闭.