#45536: Andrew Wiggins dunking on Luka Doncic


1121226@stu.wghs.tp.edu.tw (Arthur✨小蜜蜂)

學校 : 臺北市私立薇閣高級中學
編號 : 252772
來源 : [60.248.154.143]
最後登入時間 :
2025-04-09 15:55:05
a536. 11689 - Soda Surpler -- UVa11689 | From: [60.248.154.143] | 發表日期 : 2025-03-14 09:39

#include <bits/stdc++.h>  
using namespace std;  
int main() {  
    int N;
    cin>>N;  
    for (int i=0;i<N;i++){  
        int e,f,c;
        cin>>e>>f>>c;
        int total=e+f; // 總空瓶數  
        int empty=0; // 喝到的汽水瓶數  
        // 只要還能換到汽水,就持續循環  
        while (total>=c){  
            int new_bottles=total/c; // 可以得到的新汽水瓶數  
            empty+=new_bottles; // 累加喝到的汽水瓶數  
            total=total-(new_bottles*c)+new_bottles; // 更新空瓶數  
        }  
        cout<<empty<<endl;
    }  

    return 0;  
}  
 
ZeroJudge Forum