Rogon @ 2022-11-28 21:31:50
#include "bits/stdc++.h"
using namespace std;
bool pd(string s)
{
string t=s;
reverse(s.begin(),s.end());
if(t==s) return true;
return false;
}
int tomath(string s)
{
int k=0;
for(int i=0;i<s.size();i++)
{
k+=(s[i]-'0');
if(i!=s.size()-1) k=k*10;
}
return k;
}
string tomorrow(string s)
{
string d="",m="",y="";
for(int i=6;i<=7;i++) d=d+s[i];
for(int i=4;i<=5;i++) m+=s[i];
for(int i=0;i<=3;i++) y+=s[i];
int day=tomath(d),month=tomath(m),year=tomath(y);
int da[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
if(year%400==0 ||(year%4==0 && year%100!=0)) da[2]++;
if(day==da[month])
{
day=1;
if(month==12)
{
month=1;
year++;
}
else month++;
}
else day++;
string g="";
g=g+char(year/1000+int('0'));
g=g+char(year/100%10+int('0'));
g=g+char(year/10%10+int('0'));
g=g+char(year%10+int('0'));
g=g+char(month/10+int('0'));
g=g+char(month%10+int('0'));
g=g+char(day/10+int('0'));
g=g+char(day%10+int('0'));
return g;
}
int main()
{
string left,right;
int t=0;
cin >> left >> right;
if(pd(right)) t++;
while(left!=right)
{
if(pd(left)) t++;
left=tomorrow(left);
}
printf("%d",t);
return 0;
}
by Nuclear_flashlight @ 2022-12-11 22:44:36
idontno