HDU 3139 Soda Surpler [模拟]

来源:互联网 发布:过期域名删除查询 编辑:程序博客网 时间:2024/05/16 01:20

Description

一开始有A+B 个瓶子,C个空瓶能换一个新的,问额外能喝多少个

Alogrithm

模拟

Code

#include <iostream>using namespace std;int main(){  int e, f, c;  while (cin >> e >> f >> c)  {    e = e + f;    int ans = 0;    while (e >= c)    {      ans += e / c;      e = e / c + e % c;    }    cout << ans << endl;  }}
0 0
原创粉丝点击