当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5417:Victor and Machine

题目描述
Victor has a machine. When the machine starts up, it will pop out a ball immediately. After that, the machine will pop out a ball every $w$ seconds. However, the machine has some flaws, every time after $x$ seconds of process the machine has to turn off for $y$ seconds for maintenance work. At the second the machine will be shut down, it may pop out a ball. And while it's off, the machine will pop out no ball before the machine restart.

Now, at the $0$ second, the machine opens for the first time. Victor wants to know when the $n$-th ball will be popped out. Could you tell him?
输入解释
The input contains several test cases, at most $100$ cases.

Each line has four integers $x$, $y$, $w$ and $n$. Their meanings are shown above。

$1\leq x,y,w,n\leq 100$.
输出解释
For each test case, you should output a line contains a number indicates the time when the $n$-th ball will be popped out.
输入样例
2 3 3 3
98 76 54 32
10 9 8 100
输出样例
10
2664
939
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5417

最后修改于 2020-10-25T23:22:29+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/65536K(Java/Others)