Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- int main()
- {
- long long int t,i,a,b,cnt;
- scanf("%lld",&t);
- for(i=1;i<=t;i++){
- scanf("%lld %lld",&a,&b);
- printf("Case %lld: ",i);
- cnt=(b-a)-(b-a)/3;
- if(a%3==0 && b%3==0)
- cnt++;
- else if((a+1)%3==0 && ((b+1)%3==0 || b%3==0))
- cnt++;
- printf("%lld\n",cnt);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement