为什么80?本地测试点没问题呀.......

P2010 [NOIP2016 普及组] 回文日期

xzlhxc_ed @ 2018-05-08 18:55:07

#include<iostream>
using namespace std;
int date[13]={0,31,29,31,30,31,30,31,31,30,31,30,31},a,b;
int mach(int x)
{
    if(x<100)return 0;
    int xx,x1,x2,x3,x4;
    xx=x*10000;
    x1=x%10;
    x2=((x-x1)/10)%10;
    x3=((x-x1-x2*10)/100)%10;
    x4=x/1000;
    if(x1*10+x2>13||x1*10+x2<1)return 0;
    if(x3*10+x4<1||x3*10+x4>date[x1*10+x2])return 0;
    xx=xx+x1*1000+x2*100+x3*10+x4;
    if(xx>b)return 0;
    if(xx<a)return 0;
    return 1;

}
int main()
{
    int aa,bb,s=0;
    cin>>a>>b;
    aa=a/10000;
    bb=b/10000;
    for(int i=aa;i<=bb;i++)
    {
        if(mach(i))s++;
    }
    cout<<s<<endl;
    return 0;
}

by 卢睿韬(逝) @ 2018-07-07 17:32:07

我也不知道,我也是80分.


|