zhaoanqiEtayo @ 2023-07-26 16:18:52
#include<stdio.h>
#include<stdlib.h>
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++;
printf("%d ",i);
}
printf("%d\n",a);
}
return 0;
}
by ProzacPainkiller @ 2023-07-26 16:20:50
把闰年存在一个数组里啊(
by ProzacPainkiller @ 2023-07-26 16:21:39
或者再遍历一遍,第一遍计数,第二遍再输出闰年。 @zhaoanqiEtayo
by LittleAcbg @ 2023-07-26 16:22:08
#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:36:48
@zhaoanqiEtayo
by zhaoanqiEtayo @ 2023-07-26 17:04:05
@LuoJingjia x谢谢
by zhaoanqiEtayo @ 2023-07-26 17:04:29
@eggome 蟹蟹
by zhaoanqiEtayo @ 2023-07-26 17:06:56
@LuoJingjia 可是只有一个过了其它四个WA