ICPC Live Archive 8081 Leap Birthdays Solution Asia - Dhaka
Problem Link
ICPC Live Archive 8081 Leap Birthdays Solution Asia - Dhaka
ICPC Live Archive 8081 Leap Birthdays Solution Asia - Dhaka
#include<bits/stdc++.h>
using namespace std;
int leave(int j)
{
if(j%400==0)
return 1;
else if(j%100!=0 && j%4==0)
return 1;
return 0;
}
int main()
{
int t,i=0;;
cin>>t;
while(t--)
{
i++;
int d,m,y,qy;
cin>>d>>m>>y>>qy;
printf("Case %d: ",i);
if(d==29 && m==2)
{
int a,c=0;
for(int j=y+1;j<=qy;j++)
{
a=leave(j);
if(a==1)
c++;
}
cout<<c<<endl;
}
else
{
cout<<qy-y<<endl;
}
}
return 0;
}
No comments