LKCoding @ 2020-04-24 22:28:45
#include <bits/stdc++.h>
using namespace std;
bool runnian(int n){ //闰年函数
if((n%4!=0)||(n%100==0&&n%400!=0)) return 0;
else return 1;
}
int main(){
int x,y,num=0,a[1000];
cin>>x>>y;
for(int i=x;i<=y;i++){
if(runnian(i)){
num++;
a[num-1] = i;
}
}
cout<<num<<"\n";
for(int i=0;i<num;i++) cout<<a[i]<<" "<<endl;
return 0;
}
by 吴勉之 @ 2020-04-24 22:35:55
还有输出空格又换行是什么鬼???
by LKCoding @ 2020-04-24 22:58:58
@吴勉之 谢谢,太粗心了