UVa Solution 11689 - Soda Surpler

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int e,f,c;
    int test;
    cin >>test;
    int total,rem,temp;
    for(int i=0;i<test;i++)
    {
        cin>>e>>f>>c;
        rem=0;
        temp=e+f;
        while(temp>=c)
        {
            total=temp/c;
            rem+=total;
            temp=total+(temp%c);

        }
        cout<<rem<<endl;

    }
    return 0;
}
SHARE

Amit Ghosh

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment