Run ID:148046

提交时间:2026-02-09 15:14:24

#include<bits/stdc++.h> using namespace std; int main(){ int init_bottle, exchange; // 初始空瓶数、换1瓶酒需要的空瓶数 cin >> init_bottle >> exchange; int total_drink = 0; // 总共喝的酒数 int current_bottle = init_bottle; // 当前持有的空瓶数 // 循环:只要空瓶数够换1瓶酒,就继续换 while (current_bottle >= exchange) { int drink = current_bottle / exchange; // 本次能换的酒数(也是喝的数量) total_drink += drink; // 累计喝的酒数 // 更新空瓶数:换酒后剩下的空瓶 + 喝完酒新产生的空瓶 current_bottle = (current_bottle % exchange) + drink; } cout << total_drink << endl; return 0; }