Advertisement
erfanul007

LOJ 1414

Dec 2nd, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. char str1[50],str2[50];
  6. long long int t,a,b,x,y,i,c,fr,hd,frhd;
  7. scanf("%lld",&t);
  8. for(i=1;i<=t;i++){
  9. c=0;
  10. scanf("%s %lld, %lld",str1,&a,&x);
  11. scanf("%s %lld, %lld",str2,&b,&y);
  12. if(strcmp(str1,"January")!=0 && strcmp(str1,"February")!=0)
  13. x++;
  14. if((strcmp(str2,"January")==0 || (strcmp(str2,"February")==0) && b<29))
  15. y--;
  16.  
  17. fr = y/4-(x-1)/4;
  18. hd = y/100-(x-1)/100;
  19. frhd = y/400-(x-1)/400;
  20. c = fr - hd + frhd;
  21. printf("Case %lld: %lld\n",i,c);
  22. }
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement