Advertisement
Pabon_SEC

Soda Surpler

Sep 3rd, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     long long int N,e,f,c,a,b,d,g,h,i,rem;
  5.     scanf("%lld",&N);
  6.     while(N--)
  7.     {
  8.         scanf("%lld%lld%lld",&e,&f,&c);
  9.         i=0;
  10.         a=e+f;
  11.         while(a>=c)
  12.         {
  13.             rem=a%c;
  14.             b=rem;
  15.             d=a/c;
  16.             i=i+d;
  17.             a=b+d;
  18.         }
  19.         g=i;
  20.         if(a>=c)
  21.         {
  22.             h=a/c;
  23.             printf("%lld\n",g+h);
  24.         }
  25.         else
  26.             printf("%lld\n",g);
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement