蒟蒻#5求助

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

gdfz02sjy @ 2024-03-17 16:10:09

#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,rn[114];
int main(){
    cin>>a>>b;
    for(int i=a;i<=b;i++){
        if(i%100==0){
            if(i%400==0){
                d++;
                rn[d]=i;
            }
        }
        else{
            if(i%4==0){
                d++;
                rn[d]=i;
            }
        }
    }
    cout<<d<<endl;
    for(int i=1;i<=d;i++){
        cout<<rn[i]<<' ';
    }
    return 0;
} 

明明都对上了,最后一个样例死活过不了


by I_Love_DS @ 2024-03-17 16:12:54

rn 数组开小了。

开到 1000 才行。


by Voltaris @ 2024-03-17 16:13:33

数组开114你认真的?


by Voltaris @ 2024-03-17 16:14:29

你好歹是给绿名啊!做入门题?


by gdfz02sjy @ 2024-03-20 14:33:09

@Yaofangyu @liuruiqing 可以了谢谢


by gdfz02sjy @ 2024-03-20 14:33:29

@Yaofangyu 不行吗?(doge


by Entity_XD @ 2024-03-23 11:11:26

homo无处不在


by GeorgeCHN @ 2024-04-02 17:47:30

//注意:3000-1582=1418,数组至少要600


by luogugaowan_10086 @ 2024-04-26 19:09:22

@Entity_XD +1


by A_liusizhe @ 2024-07-11 14:33:53

貌似不用开数组。。。。。


by NullPointerExpection @ 2024-07-11 21:50:13

@Yaofangyu 我也绿名做入门题qwq


|