问题标题: 酷町堂:1422急!

0
0
已解决
林炜曦
林炜曦
初级守护
初级守护

WA70分 

#include<iostream>
#include<ctime>
#include<cstdio>
using namespace std;
int ch[]={0,31,28,31,30,31,30,31,31,30,31,30,31},cnt;
bool check(int y,int m,int d){
    return (m<=12&&m!=0&&d<=ch[m]&&d!=0);
}
int main(){
    int date1,date2;
    cin>>date1>>date2;
    for(int y=date1/10000;y<=date2/10000;y++){
        int d=y/100%10*10+y/1000;
        int m=y%10*10+y/10%10;
        int t=y*10000+m*100+d;
        if(check(y,m,d)&&t>=date1&&t<=date2)
            cnt++;
        else
            continue;
        // cout<<y<<" "<<m<<' '<<d<<'\t'<<t<<"\n";
    }
    cout<<cnt;
    return 0;
}

哪错了???????

林炜曦在2023-10-08 21:20:49追加了内容

求助:70分 Wrong Answer


0
0
李宸霈
李宸霈
初级光能
初级光能

没有判断闰年!!!

闰年2月29天

平年2月28天

我要回答