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