标签:style http color os io ar amp line
题意:给定怪兽血量h,你攻击力a,怪物回血力b,你攻击k次要休息一次,问能否杀死怪兽
思路:签到题,注意最后一下如果打死了怪,那么怪就不会回血了
思路:
#include <cstdio> #include <cstring> typedef long long ll; ll h, a, b, k; bool solve() { if (a >= h) return true; if (b >= a) return false; if (h - (k - 1) * a + b * (k - 1) <= a) return true; ll s = -a * k + b * (k + 1); if (s >= 0) return false; return true; } int main() { int cas = 0; while (~scanf("%I64d%I64d%I64d%I64d", &h, &a, &b, &k) && h) { printf("Case #%d: ", ++cas); printf("%s\n", solve() ? "YES" : "NO"); } return 0; }
HDU 4950 Monster(公式),布布扣,bubuko.com
标签:style http color os io ar amp line
原文地址:http://blog.csdn.net/accelerator_/article/details/38569711