求助,那错了

P5737 【深基7.例3】闰年展示

huangzirui2012 @ 2024-10-20 15:12:25

#include<bits\stdc++.h>
using namespace std;
typedef long long ll;
ll x,y,a[3005],sum;
int main(){
    cin>>x>>y;
    for(int i=x;i<=y;i++){
        if((i%4==0&&i%100!=0)||i%400==0){
            a[++sum]=i;
        }
    }
    cout<<sum<<endl;
    for(int i=1;i<=sum;i++){
        cout<<a[i]<<" ";
    }
    return 0;
}

by huangzirui2012 @ 2024-10-20 15:13:57

help!!!


by whr24syy119 @ 2024-10-20 15:53:44

@huangzirui2012 第一行头文件打错了。


by whr24syy119 @ 2024-10-20 15:56:44

dev能过的去,但洛谷严,过不去。


by suyelei @ 2024-10-20 16:04:03

那错了!


by whr24syy119 @ 2024-10-20 16:13:58

@suyelei 6


by Ymbsis @ 2024-10-27 17:44:11

是不是忘记处理没有闰年的情况了?


|