らての精進日記

修行をします

aoj0093:Leap Year

解法

is_leap(is_uruuとも)を適当に作って適当に出力。

コード

#include<bits/stdc++.h>
using namespace std;

bool is_yeap(int y){
    return y%400==0||(y%4==0&&y%100);
}
int main(){
    int a,b;
    bool flag=false;

    while(scanf("%d%d",&a,&b),a||b){
        if(flag)puts("");
        else flag=true;
        bool latte=false;
        for(int i=a;i<=b;i++){
            if(is_yeap(i)){
                printf("%d\n",i);
                latte=true;
            }
        }

        if(!latte)puts("NA");
    }

    return 0;
}