37分,紧急求助

P2010 [NOIP2016 普及组] 回文日期

听取WA声一片5 @ 2021-08-21 11:26:45

#include<iostream>
using namespace std;
int month[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int main()
{
    int x,y;
    int s,c,n=0;
    cin>>x>>y;
    for(int i=1;i<=12;++i)
    {
        for(int j=1;j<=month[i];++j)
        {
            c=(i%10)*100+(j/i)*100+(i%10)*10+(i/10);
            s=c*10000+i*100+j;
            if(s<x||s>y) continue;
            n++;
        }
    }
    cout<<n;
}

我的代码样例都过不了,到得哪错了, 谢谢各位大神,求速回复!!!!!!


by SunsetSamsara @ 2021-08-21 11:34:08

头像好评


by SunsetSamsara @ 2021-08-21 11:36:03

@听取WA声一片5 这样

#include<iostream>
using namespace std;
int month[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int main(){
    int x,y;
    int s,c,n=0;
    cin>>x>>y;
    for(int i=1;i<=12;++i){
        for(int j=1;j<=month[i];++j){
            c=(j%10)*1000+(j/10)*100+(i%10)*10+(i/10);
            s=c*10000+i*100+j;
            if(s<x||s>y) continue;
            n++;
        }
    }
    cout<<n;
}

by SunsetSamsara @ 2021-08-21 11:36:20

AC记录


by 听取WA声一片5 @ 2021-08-21 11:39:08

谢谢大神,好人一生平安


by 时·透·夫·人 @ 2021-08-21 11:40:10

刚想说被说了


by 听取WA声一片5 @ 2021-08-21 11:40:23

@Canstant0x5F3759DF 加MC好友?


by SunsetSamsara @ 2021-08-21 11:42:43

@听取WA声一片5 ?


by 听取WA声一片5 @ 2021-08-21 11:50:56

@Canstant0x5F3759DF 你有《我的世界》 账号吗?


by SunsetSamsara @ 2021-08-21 11:54:11

@听取WA声一片5 现在我不太方便说这些……


by SunsetSamsara @ 2021-08-21 11:54:25

@听取WA声一片5 可以私信交流


|