60分,救我!QWQ

P2010 [NOIP2016 普及组] 回文日期

abc20131113 @ 2024-08-26 18:02:09


#include<bits/stdc++.h>  
using namespace std;  
int n[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};  
int main(){  
//  freopen(".in","r",stdin);  
//  freopen(".out","w",stdout);  
    int f,t;  
    cin>>f>>t;  
    int y=f/10000;  
    int m=f%10000/100;  
    int r=f%100;  
    int sum=0;  
    //cout<<year<<" "<<month<<" "<<day<<endl;  
    while(y*10000+m*100+r<=t){  
        if(y%400==0||y%100!=0&&y%4==0){  
            n[2]=29;  
        }  
        else{  
            n[2]=28;  
        }  
        int a,b,c,d;  
        d=m/10;  
        c=m%10;  
        b=r/10;  
        a=r%10;  
        if(d+10*c+100*b+1000*a==y){   
            sum++;  
        }  
        if(d+1>n[m]){  
            d=0;  
            m++;  
        }  
        if(m>12){  
            m=1;  
            y++;  
        }  
        r++;  
    }  
    cout<<sum;  
    return 0;  
}

by wangxiaoyi1118 @ 2024-08-31 22:07:14

@sapo1o 对,没错,我是菜,但那也轮不到你来教训


by DengDuck @ 2024-08-31 22:11:01

别吵了,你俩谁比谁强啊


by DengDuck @ 2024-08-31 22:11:52

@sapo1o 不要对别人指指点点

@wangxiaoyi1118 多去做点题

散了散了


by abc20131113 @ 2024-09-16 16:40:21

我滴妈,我就发个讨论,咋就吵起来了


by abc20131113 @ 2024-09-16 16:40:44

@DengDuck 有道理


by PYM20111102 @ 2024-10-04 22:46:49

@abc20131113 你这帖真热闹! @DengDuck 劝架之力犹如神助!


by xxc123 @ 2024-10-06 10:10:23

@wangxiaoyi1118 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~


by wangxiaoyi1118 @ 2024-10-06 13:17:03

@PYM20111102 DengDuck我喊来的...


by PYM20111102 @ 2024-10-06 13:30:21

@wangxiaoyi1118 那你可真……善良。


by wangxiaoyi1118 @ 2024-10-06 13:31:15

@PYM20111102 谢


上一页 | 下一页