记录代码
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int sum = 0;
int s[355];
bool K(int x) {
if (x % 4 == 0 && x % 100 != 0 || x % 400 == 0) return true;
else return false;
}
void F(int a,int b) {
while (a < b) {
if (K(a)) {
s[sum] = a;
a++;
sum++;
}
a++;
}
}
int main() {
int a, b;
cin >> a >> b;
F(a, b);
cout << sum << endl;
for (int i = 0; i < sum; i++)cout << s[i] <<" ";
return 0;
}
P5737,题号