You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
444 B
22 lines
444 B
#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;
|
|
} |