bird_秒切橙题 @ 2020-05-27 20:07:11
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
long long x,y,s=0,a[1001];
cin>>x>>y;
long long i;
for(i=x;i<=y;i++)
{
if(i%4==0&&i%100!=0)
{
s+=1;
a[i]=i;
}
else if(i%100==0&&i%400==0)
{
s+=1;
a[i]=i;
}
else
{
continue;
}
}
cout<<s<<"\n";
for(i=x;i<=y;i++)
{
cout<<a[i]<<" ";
}
}
by k3v1n070828 @ 2020-05-27 20:27:48
@liqingyang 我是说那个删掉的帖子,我被人在那个帖子@了,通过我同学给的消息,所以知道有人在D我
by liqingyang @ 2020-05-27 20:28:59
@M652 所以是哪个帖子,说了什么qwq
by k3v1n070828 @ 2020-05-27 20:36:11
@liqingyang 我当时没上线,所以不知道,来的时候lz已经删帖了
by liqingyang @ 2020-05-27 20:36:48
@M652 唉,大概D了个啥内容呢?
by k3v1n070828 @ 2020-05-27 20:40:36
@liqingyang 就是说这个博客人身攻击
发帖目的:想禁我博客
by k3v1n070828 @ 2020-05-27 20:41:09
陈述事实+自己想法算人身攻击吗?@small_bird 回答我
by liqingyang @ 2020-05-27 20:46:16
@M652 哇,讲的太好了!
by Node_Edge @ 2020-06-03 21:00:44
#include<bits/stdc++.h>
using namespace std;
bool year(int n){
return n%4==0&&(n%100!=0||n%400==0);
}
int main(){
int x,y,sum=0;
cin>>x>>y;
for(int i=x;i<=y;i++){
if(year(i)) sum++;
}
cout<<sum<<endl;
for(int i=x;i<=y;i++){
if(year(i)) cout<<i<<" ";
}
return 0;
}
by peiran @ 2021-07-31 17:48:26
还有一个世纪闰年,条件:i%400==0