daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Feb 19th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int T, i, j, a, b, c;
  6.     scanf("%d", &T);
  7.     for(i = 1; i <= T; i++)
  8.     {
  9.         scanf("%d %d", &a, &b);
  10.         c = 0;
  11.         for(j = a; j <= b; j++)
  12.         {
  13.             if((j%3 == 0 || j%3 == 2) && j != 2)
  14.                 c++;
  15.             if(j >= 2 && (b-j)%3 == 0 && b > 5)
  16.             {
  17.                 c += 2*(b-j)/3;
  18.                 break;
  19.             }
  20.         }
  21.         printf("Case %d: %d\n", i, c);
  22.     }
  23. }
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