记录编号 512691 评测结果 AAAAAAAAAA
题目名称 [NOIP 2016PJ]回文日期 最终得分 100
用户昵称 GravatarINFINITY 是否通过 通过
代码语言 C++ 运行时间 0.002 s
提交时间 2018-10-06 09:13:35 内存使用 0.32 MiB
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
int main()
{
	freopen("datea.in","r",stdin);
	freopen("datea.out","w",stdout);
int year1,mon1,day1,year2,mon2,day2,date1,date2,monin,dayin,goals=0;
    cin>>date1>>date2;
    year1=date1/10000;year2=date2/10000;
    day1=date1%100; day2=date2%100;
    mon1=date1%10000; mon1=mon1/100;mon2=date2%10000; mon2=mon2/100;
    for(int i=year1;i<=year2;i++)
    {
	    int monin1,monin2 ;
    	monin1=i%10;monin2=i%100-monin1;monin2=monin2/10;
    	int dayin1,dayin2;
    	dayin1=i/100;dayin1=dayin1%10;dayin2=i/1000;
    	monin=monin1*10+monin2; dayin=dayin1*10+dayin2;
    	 if((i%4==0)||(i%400==0))
	{    	if((monin==1)||(monin==3)||(monin==5)||(monin==7)||(monin==8)||(monin==10)||(monin==12))
    	{      if((dayin<=31)&&(dayin>0))goals++;	}
		    else
		    {
			  if((monin<12)&&(monin>0)&&(dayin<=30)&&(dayin>0))
			  {
				if((monin==2)&&(dayin<=29)) goals++; else goals++;
			  }
		    }
	}
	    else
		{
			if((monin==1)||(monin==3)||(monin==5)||(monin==7)||(monin==8)||(monin==10)||(monin==12))
    	{      if((dayin<=31)&&(dayin>0))goals++;}
		    else
		    {
			  if((monin<12)&&(monin>0)&&(dayin<=30)&&(dayin>0))
			  {
				if((monin==2)&&(dayin<=28)) goals++; else goals++;
			  }
			}    
	 } 
    } 
 cout<<goals;
}