#include<bits/stdc++.h>
#define ll long long int
using namespace std;
map<string, int>mp;
int main()
{
mp["January"] = 1, mp["February"] = 2, mp["March"] = 3, mp["April"] = 4;
mp["May"] = 5, mp["June"] = 6, mp["July"] = 7, mp["August"] = 8;
mp["September"] = 9, mp["October"] = 10, mp["November"] = 11, mp["December"] = 12;
string s1, s2;
char chr1, chr2;
ll day1, day2, month1, month2, year1, year2, c = 0, t, j = 1;
cin >> t;
while(t--)
{
cin >> s1 >> day1 >> chr1 >> year1;
cin >> s2 >> day2 >> chr2 >> year2;
month1 = mp[s1];
month2 = mp[s2];
if(month1 > 2)
year1++;
if(month2 < 2 || (month2 == 2 && day2 < 29))
year2--;
c = (year2/4) - (year1-1)/4;
c = c - ((year2/100) - (year1-1)/100);
c = c + ((year2/400) - (year1-1)/400);
cout << "Case " << j++ << ": " << c << "\n";
}
return 0;
}
#define ll long long int
using namespace std;
map<string, int>mp;
int main()
{
mp["January"] = 1, mp["February"] = 2, mp["March"] = 3, mp["April"] = 4;
mp["May"] = 5, mp["June"] = 6, mp["July"] = 7, mp["August"] = 8;
mp["September"] = 9, mp["October"] = 10, mp["November"] = 11, mp["December"] = 12;
string s1, s2;
char chr1, chr2;
ll day1, day2, month1, month2, year1, year2, c = 0, t, j = 1;
cin >> t;
while(t--)
{
cin >> s1 >> day1 >> chr1 >> year1;
cin >> s2 >> day2 >> chr2 >> year2;
month1 = mp[s1];
month2 = mp[s2];
if(month1 > 2)
year1++;
if(month2 < 2 || (month2 == 2 && day2 < 29))
year2--;
c = (year2/4) - (year1-1)/4;
c = c - ((year2/100) - (year1-1)/100);
c = c + ((year2/400) - (year1-1)/400);
cout << "Case " << j++ << ": " << c << "\n";
}
return 0;
}
Comments
Post a Comment