把闰年存在一个数组里啊(
by ProzacPainkiller @ 2023-07-26 16:20:50
或者再遍历一遍,第一遍计数,第二遍再输出闰年。 @[zhaoanqiEtayo](/user/1027350)
by ProzacPainkiller @ 2023-07-26 16:21:39
```c
#include<stdio.h>
#include<stdlib.h>
int ans[114514];
int main()
{
int x,y,i,a;
scanf("%d %d",&x,&y);
for(i=x;i<=y;i++)
{
a=0;
if((i%4==0&&i%100!=0)||i%400==0)
{
a++;
ans[a]=i;
}
}
printf("%d\n",a);
for(i=1;i<=a;i++)printf("%d ",ans[i]);
return 0;
}
```
by LittleAcbg @ 2023-07-26 16:22:08
@[zhaoanqiEtayo](/user/1027350)
by LittleAcbg @ 2023-07-26 16:36:48
@[LuoJingjia](/user/531709) x谢谢
by zhaoanqiEtayo @ 2023-07-26 17:04:05
@[eggome](/user/569484) 蟹蟹
by zhaoanqiEtayo @ 2023-07-26 17:04:29
@[LuoJingjia](/user/531709) 可是只有一个过了其它四个WA
by zhaoanqiEtayo @ 2023-07-26 17:06:56