0分,,求大佬救命

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

WuXingRui_wxr @ 2020-04-11 12:22:17

#include<bits/stdc++.h>
using namespace std;
bool judge_Leap_year(int n){
    if((n%10==0&&n/10%10==0)&&(n%400==0)) return true;
    if(n%4==0) return true;
    return false;
}
int main(){
    int n,m; cin>>m>>n;
    for(int i=m;i<=n;i++) if(judge_Leap_year(i)) cout<<i<<" ";
    return 0; 
}

by WuXingRui_wxr @ 2020-04-11 12:22:26

0分


by 老子是北瓜 @ 2020-04-11 12:26:19

不得先看看样例过没过吗


by Prean @ 2020-04-11 12:26:36

@WuXingRui_wxr 这不是要求输出个数吗。。。


by Prean @ 2020-04-11 12:27:20

@WuXingRui_wxr 后2位直接%100不好吗。。。反正假如都为0也行。。。


by 老子是北瓜 @ 2020-04-11 12:28:18

@WuXingRui_wxr 咋过的!?


by Prean @ 2020-04-11 12:28:36

@WuXingRui_wxr

bool judge_Leap_year(int n){
    return n%400==0||(n%100&&n%4==0);
}

by 老子是北瓜 @ 2020-04-11 12:28:43

个数没求啊


by WuXingRui_wxr @ 2020-04-11 12:44:12

#include<bits/stdc++.h>
using namespace std;
bool judge_Leap_year(int n){
    if((n%10==0&&n/10%10==0)&&(n%400==0)) return true;
    if(n%4==0) return true;
    return false;
}
int main(){
    int n,m,t=0; cin>>m>>n;
    for(int i=m;i<=n;i++) if(judge_Leap_year(i)) t++;
    cout<<t<<"\n";
    for(int i=m;i<=n;i++) if(judge_Leap_year(i)) cout<<i<<" ";
    return 0; 
}

40分QAQ


by WuXingRui_wxr @ 2020-04-11 12:45:36

@老子是白菜 @limaopipi2022


by 老子是北瓜 @ 2020-04-11 12:48:30

@WuXingRui_wxr 有人发了判断的函数


| 下一页