问题标题: 酷町堂:3311

0
0
已解决
梁怡墨
梁怡墨
新手守护
新手守护

题目链接: 酷町堂:3311

80分

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int m,d,xq=1,n,nn,zm,zd;
int cnt=1;
string a,b;
int mon[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int main(){
    cin>>nn;
    for(int i=1;i<=nn;i++){
        cin>>a>>b;
        n=0;
        zm=(b[0]-'0')*10+b[1]-'0';
        zd=(b[2]-'0')*10+b[3]-'0';
        m=(a[0]-'0')*10+a[1]-'0';
        d=(a[2]-'0')*10+a[3]-'0';
        if(m>=zm){
            if(m>zm){
                swap(zm,m);
                swap(zd,d);
            }else{
                if(d>=zd){
                    swap(zm,m);
                    swap(zd,d);
                }
            }
        }
        while(1){
            d++;
            n++;

            if(d>mon[m]){
                d=1;
                m++;
            }
            if(n==100){
                break;
            }
            //cout<<m<<' '<<d<<" "<<n<<endl;
        }
        if(m>=zm){
            if(m>zm){
                cout<<"NO"<<endl;
            }else{
                if(d>=zd){
                    cout<<"NO"<<endl;
                }else{
                    cout<<"YES"<<endl;
                }
            }
        }else{
            cout<<"YES"<<endl;
        }
    }
    return 0;
}

 


0
我要回答