Sunday, April 24, 2016

Published April 24, 2016 by with 0 comment

UVA 11689: Soda Surpler- Solution

#include <stdio.h>
int main()
{
    int n,e,f,c,p,s;
    scanf("%d",&n);
    while (n--)
    {
        scanf("%d%d%d",&e,&f,&c);
        s=0;
        p=e+f;
        while (p>=c)
        {
            s=s+p/c;
            p=p/c+p%c;
        }
        printf("%d\n",s);
    }
    return 0;
}
      edit

0 comments:

Post a Comment