为啥5个re,求助
查看原帖
为啥5个re,求助
1252272
shupengrui楼主2025/2/3 16:27
#include<bits/stdc++.h>
using namespace std;
int c[3000],js;
int rn(int x)
{
	if(x%400==0) return x;
	else if(x%4==0&&x%100!=0) return x;
	else return 0;
}
int main()
{
	int a,b;
	cin>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(rn(i)!=0)
		{
			js++;
			c[i]=1;
		}
	}
	cout<<js<<endl;
	for(int i=1;i<=3000;i++)
	{
		if(c[i]==1) cout<<i<<" ";
	}
	return 0;
}
2025/2/3 16:27
加载中...