# 題目: UVa 11689 - Soda Surpler
# 題目說明
Tim今天超級渴
求他今天最多能喝幾罐可樂?
INPUT:
第一行輸入一個整數N,代表有N筆資料
每筆資料有三個整數e、f、c
e代表他擁有的瓶子數f代表他今天找到的瓶子數c代表幾個瓶子能換一瓶可樂
OUTPUT:
輸出能兌換可樂的最大數量
# 解題方法
重複累加(e + f / c)的數量,直到e + f < c
# 參考程式碼
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int N, e, f, c;
cin >> N;
while (N--)
{
cin >> e >> f >> c;
int total = 0, now = e + f;
while (now >= c)
{
total += now / c;
now = now % c + now / c;
}
cout << total << "\n";
}
return 0;
}