@[wrk20111205](/user/720799)
```cpp
#include<bits/stdc++.h>
using namespace std;
short a,b,c[400],d;
int main(){
cin>>a>>b;
for(short i=a;i<=b;i++){
if(i%4==0&&(i%100!=0||i%400==0)){
c[d]=i;d++;
}
}
cout<<d<<endl;
for(short i=0;i<d;i++) cout<<c[i]<<' ';
return 0;
}
```
by _buzhidao_ @ 2023-08-20 21:56:15
@[wrk20111205](/user/720799) 四年一闰,百年不闰,四百年再闰。
by _buzhidao_ @ 2023-08-20 21:56:59
@[wrk20111205](/user/720799) 闰年判断不对
```cpp
#include<bits/stdc++.h>
using namespace std;
bool r(long long i){
if(i%4==0 && i%100!=0 || i%400==0 && i%3200!=0) return 1;
else return 0;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
long long x,y,a=0;
cin>>x>>y;
for(int i=x;i<=y;++i){
if(r(i)) a++;
}
cout<<a<<endl;
for(int j=x;j<=y;++j){
if(r(j)) cout<<j<<" ";
}
return 0;
}
```
by FurippuWRY @ 2023-08-20 22:00:37