Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int found(int a)
- {
- int res=a*2;
- res=res/3;
- res=(int)res;
- if(a%3==2||a%3==0)
- {
- return res;
- }
- else
- {
- return res-1;
- }
- }
- int hresult(int a,int b)
- {
- int top=found(b);
- if(a%3 !=1)
- {
- int min=found(a)-1;
- }
- else
- {
- int min=found(a);
- }
- return top-min;
- }
- int main(void)
- {
- int a,b,cases,caseno=0;
- scanf("%d",&cases);
- while(cases--)
- {
- scanf("%d %d",&a,&b);
- // printf("%d %d\n",found(b),found(a));
- printf("Case %d: %d\n",++caseno,hresult(a,b));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement