Advertisement
jakaria_hossain

lightoj - 1414 - February 29

Aug 23rd, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. map<string,int>mp;
  5. void setm()
  6. {
  7. mp["January"]=1;
  8. mp["February"]=2;
  9. mp["March"]=3;
  10. mp["April"]=4;
  11. mp["May"]=5;
  12. mp["June"]=6;
  13. mp["July"]=7;
  14. mp["August"]=8;
  15. mp["September"]=9;
  16. mp["October"]=10;
  17. mp["November"]=11;
  18. mp["December"]=12;
  19. }
  20. int main()
  21. {
  22. int tst;
  23. setm();
  24. cin>>tst;
  25. for(int t=1; t<=tst; t++)
  26. {
  27. string smnt,fmnt,s;
  28. ll syr,fyr,sdt,fdt,start,eend,cnt=0;
  29. cin>>smnt>>sdt>>s>>syr;
  30. cin>>fmnt>>fdt>>s>>fyr;
  31. if(mp[smnt]>2)
  32. {
  33. syr++;
  34. }
  35.  
  36.  
  37. if(fdt<29)
  38. {
  39. if(mp[fmnt]==1)
  40. fyr--;
  41. else if(mp[fmnt]==2)
  42. fyr--;
  43. }
  44. else if(fdt>29)
  45. if(mp[fmnt]==1)
  46. fyr--;
  47.  
  48. cnt=(fyr)/4-(syr-1)/4;
  49. cnt+=(fyr)/400-(syr-1)/400;
  50. cnt-=(fyr)/100-(syr-1)/100;
  51.  
  52. cout<<"Case "<<t<<": "<<cnt<<endl;
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement