linyiyi123456 @ 2023-03-08 23:35:28
#include<stdio.h>
int run(int n)
{
int ret=0;
if((n%4==0&&n%100!=0)||(n%400==0))
{
ret=1;
}
return ret;
}
int main()
{
int x,y,i,n=0;
x>=1582&&x<y&&y<=3000;
int a[3];
scanf("%d %d",&x,&y);
for(i=x;i<=y;i++)
{
if(run(i))
{
a[n++]=i;
}
}
printf("%d\n",n);
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
return 0;
}
by huangrenheluogu @ 2023-03-09 10:23:25
a数组开太小了,谁说最多只有3个。
by linyiyi123456 @ 2023-03-09 23:26:14
@huangrenheluogu 哦哦,我知道了,谢谢大佬