luogugaowan_10086 @ 2024-04-26 19:07:04
求助各位大佬,这个代码怎么没有全部AC
#include <bits/stdc++.h>
using namespace std;
int year[105];
void Year(int x,int y){
cin>>x>>y;
int cnt=0;
for(int i=x;i<=y;i++){
if((i%4==0&&i/100!=0)||i%400==0){
cnt++;
year[cnt]=i;
}
}
cout<<cnt<<endl;
for(int i=1;i<=cnt;i++){
cout<<year[i]<<' ';
}
}
int main(){
int x,y;
Year(x,y);
return 0;
}
亲测样例外输入数据也无错误
by LittleL0124 @ 2024-04-26 19:13:54
@luogugaowan_10086 if判断那里是i%100!=0
by luogugaowan_10086 @ 2024-04-26 19:15:12
@LittleL0124 谢谢