Advertisement
jakaria_hossain

lightoj - 1136 - Division By 3

Aug 21st, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define fast()(ios_base::sync_with_stdio(false),cin.tie(NULL));
  4. typedef long long ll;
  5. int main()
  6. {
  7. ll test;
  8. cin>>test;
  9. for(ll t=1;t<=test;t++)
  10. {
  11. ll a,b,c,d,e,f;
  12. cin>>a>>b;
  13. c=a/3;
  14. if(a%3!=0)c++;
  15. d=b/3;
  16. if(b%3!=0)d++;
  17. e=(d-c)*2+2;
  18. if(a%3==0)e--;
  19. if(b%3==1)e-=2;
  20. if(b%3==2)e--;
  21. cout<<"Case "<<t<<": "<<e<<endl;
  22.  
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement