SHARE
TWEET

lightoj - 1136 - Division By 3

jakaria_hossain Aug 21st, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top