#55637: C++ 極簡解


yp11550392@yphs.tp.edu.tw (ZEROJUDGE)


#include <iostream>
using namespace std;

// 數學公式:算出 y 年之前所有的閏年數
int count_leap(int y) { 
    return (y / 4) - (y / 100) + (y / 400); 
}

int main() {
    int a, b;
    // 連續讀取輸入,直接輸出相減結果
    while (cin >> a >> b) {
        cout << count_leap(b) - count_leap(a - 1) << "\n";
    }
    return 0;
}


//嚴禁抄襲 !