| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 148046 | 罗迎甲 | 14能吸多少根烟 | C++ | Wrong Answer | 0 MS | 268 KB | 777 | 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; }
------Input------
159 16
------Answer-----
169
------Your output-----
10