Friday, February 18, 2011

11689 - Soda Surpler


#include<stdio.h>

int main()
{
    int t,e,f,c,k;
    //freopen("in.txt","r",stdin);

    scanf("%d",&t);
    while(t--)
    {
        scanf("%d%d%d",&e,&f,&c);

        f=f+e,k=0;

        while(f>=c)
        {
            e=f/c;
            k=k+e;
            f=e+f%c;
        }

        printf("%d\n",k);
    }
    return 0;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.