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