Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- long long int N,e,f,c,a,b,d,g,h,i,rem;
- scanf("%lld",&N);
- while(N--)
- {
- scanf("%lld%lld%lld",&e,&f,&c);
- i=0;
- a=e+f;
- while(a>=c)
- {
- rem=a%c;
- b=rem;
- d=a/c;
- i=i+d;
- a=b+d;
- }
- g=i;
- if(a>=c)
- {
- h=a/c;
- printf("%lld\n",g+h);
- }
- else
- printf("%lld\n",g);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement