#12604: C++AC解


st990185@gmail.com (風神)

School : 臺北市立東湖國中
ID : 67139
IP address : [220.136.196.36]
Last Login :
2017-07-03 18:12:43
a536. 11689 - Soda Surpler -- UVa11689 | From: [124.11.195.228] | Post Date : 2017-08-23 10:13

#include<bits/stdc++.h>
using namespace std;

int main(){
    int t,e,f,c,sum,colas;
    while(cin>>t){
        for(int i=0;i<t;i++){
            cin>>e>>f>>c;
            sum=0;
            colas = e+f;
            while(colas/c){
                sum += colas/c;
                colas =colas/c+colas%c;
            }

            cout<<sum<<endl;
        }
    }
}
 
ZeroJudge Forum