what?

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

xuekaiyang @ 2024-04-03 16:42:55


#include<bits/stdc++.h>
using namespace std;
int x,y,z[1500],s;
int main(){
    cin>>x>>y;
    for(int i=x;i<=y;i++){
           if(i%4==0&&i%100!=0||i%400==0){
                s++;
                z[s]=i;
           }  
    }
    cout<<s<<endl;
    for(int i=1;i<=s;i++){
        cout<<z[i]<<" "; 
    }return 0;
}

by R7_O @ 2024-04-03 17:13:04

你的空格是中文空格,要改成英文的


by _safdsfdeaf_ @ 2024-04-03 17:14:17


#include<iostream>
using namespace std;
int ans[1500];
int main(){
    int begin,end;
    cin>>begin>>end;
    int cnt=0;
    for(int i=begin;i<=end;i++){
        if((i%4==0&&i%100!=0)||i%400==0){
            ans[cnt++]=i;
        }
    }
    cout<<cnt<<endl;
    for(int i=0;i<cnt;i++){
        cout<<ans[i]<<" ";
    }
    cout<<endl;
    return 0;
}

by _safdsfdeaf_ @ 2024-04-03 17:15:50

@xuekaiyang 加一下吧,团队急需人才 https://www.luogu.com.cn/team/74508


|