本文主要是介绍hdu 5417 Victor and Machine(水),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
题目链接:hdu 5417 Victor and Machine
代码
#include <cstdio>
#include <cstring>
#include <algorithm>using namespace std;int main () {int x, y, w, n;while (scanf("%d%d%d%d", &x, &y, &w, &n) == 4) {int ans = 0, now = 0, shutup = x;while (n--) {ans = now;if (now + w > shutup) {now = shutup + y;shutup = now + x;} elsenow += w;}printf("%d\n", ans);}return 0;
}
这篇关于hdu 5417 Victor and Machine(水)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!