我的输出和样例的一模一样,然后复制了个题解,生成了几个数据都一样,为什么会WA?
#include<bits/stdc++.h>
#define MAX 345
using namespace std;
bool pd(int year) {
if( !(year % 400)||!(year % 4)&&year%100)
return true;
return false;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("run.in" ,"r" , stdin);
freopen("run.out","w", stdout);
#endif
int ryear[MAX];
memset(ryear,0,sizeof(ryear));
int x,y,n,sum = 0;
bool kkk;
cin>>x>>y;
for(x,y; x <= y; x++) {
kkk = pd(x);
if(kkk) {
sum++;
ryear[n++] = x;
}
}
cout<<sum<<endl;
for(int step = 0; step < n; step++) {
cout<<ryear[step]<<" ";
}
return 0;
}
大佬救救QWQ