22 lines
444 B
C++
22 lines
444 B
C++
|
|
#include <bits/stdc++.h>
|
||
|
|
|
||
|
|
using namespace std;
|
||
|
|
|
||
|
|
//是不是闰年
|
||
|
|
bool isRunYear(int y) {
|
||
|
|
if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0) return true;
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
const int N = 2010;
|
||
|
|
int a[N];
|
||
|
|
int idx;
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
int x, y;
|
||
|
|
cin >> x >> y;
|
||
|
|
for (int i = x; i <= y; i++)if (isRunYear(i)) a[idx++] = i;
|
||
|
|
cout << idx << endl;
|
||
|
|
for (int i = 0; i < idx; i++) cout << a[i] << " ";
|
||
|
|
return 0;
|
||
|
|
}
|