Advertisement
erfanul007

Light OJ 1136

Dec 31st, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5. long long int t,i,a,b,cnt;
  6. scanf("%lld",&t);
  7. for(i=1;i<=t;i++){
  8. scanf("%lld %lld",&a,&b);
  9. printf("Case %lld: ",i);
  10. cnt=(b-a)-(b-a)/3;
  11. if(a%3==0 && b%3==0)
  12. cnt++;
  13. else if((a+1)%3==0 && ((b+1)%3==0 || b%3==0))
  14. cnt++;
  15. printf("%lld\n",cnt);
  16. }
  17. return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement