@[songboqian](/user/1236139)
或者开两个void也不是不行。
```cpp
#include<bits/stdc++.h>
using namespace std;
int x,y,sum;
void mai1(int &a,int &b){
if(a%400==0){
b++;
}else if(a%100==0){
;
}else if(a%4==0){
b++;
}
return;
}
void mai2(int &a){
if(a%400==0){
cout<<a<<' ';
}else if(a%100==0){
;
}else if(a%4==0){
cout<<a<<' ';
}
return;
}
int main(){
cin>>x>>y;
for(int i=x;i<=y;++i){
mai1(i,sum);
}
cout<<sum<<endl;
for(int i=x;i<=y;++i){
mai2(i);
}
return 0;
}
```
by Sci_8633 @ 2024-01-13 15:09:02