Eason_lyx @ 2023-10-12 21:36:16
#include<bits/stdc++.h>
using namespace std;
int days[13]={0,31,0,31,30,31,30,31,31,30,31,30,31};
int ans,fy,fm,fd,ly,lm,ld,ny,nm,nd;
bool islow()
{
if(ny>ly)return 0;
if(nm>lm)return 0;
if(nd>ld)return 0;
return 1;
}
bool hui(int year,int month,int day)
{
return (year/1000==day%10&&
year/100%10==day/10&&
year/10%10==month%10&&
year%10==month/10);
}
void next_date(int &year,int &month,int &day)
{
if(month==12&&day==31){year++;month=1;day=1;}
int da=month==2?((year%4==0&&year%100!=0||year%400==0)?29:28):days[month];
if(da==day){month++;day=1;}
else {day++;}
return;
}
void gethui()
{
ny=fy,nm=fm,nd=fd;
while(islow())
{
if(hui(ny,nm,nd))ans++;
next_date(ny,nm,nd);
}
}
int main(){
scanf("%4d%2d%2d %4d%2d%2d",&fy,&fm,&fd,&ly,&lm,&ld);
gethui();
printf("%d",ans);
return 0;
}
by Tsuki091117 @ 2023-10-15 16:54:01
@Eason13760348848 这个islow 自定义函数不对吧,前面的月份或日期大于后面的不一定没有回文日期
by Tsuki091117 @ 2023-10-15 16:56:53
输入 20110313 30111103 正确输出37 实际输出0