Codeforces Round #635 (Div. 2)的其他题解请点这里
B. Kana and Dragon Quest game
题目大意:
有一条龙有x点生命值
现在你要打到他
你有两个技能
1.使龙的血量变成
x
=
⌊
x
/
2
⌋
+
10
x=\left \lfloor x/2\right \rfloor +10
x=⌊x/2⌋+10
2.使龙的血量变成
x
=
x
−
10
x=x-10
x=x−10
但是每个技能都有使用次数,分别为n, m
思路:
当
x
<
⌊
x
/
2
⌋
+
10
时
当 x<\left \lfloor x/2\right \rfloor +10时
当x<⌊x/2⌋+10时
使用1技能效果更好,所以我们贪心,竟可能的使用1技能
当1技能效果不如2技能时我们就改用2技能
AC代码:
#include<cstdio>
#include<iostream>
#include<cstring>
#include<map>
#include<random>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn = 1e6 + 7;
int n, m;
int main() {
int T;
scanf("%d", &T);
while (T--) {
int x, n, m;
scanf("%d %d %d", &x, &n, &m);
while (n&&x/2+10<x) {
x = x / 2 + 10;
n--;
}
if (x <= m * 10)printf("YES\n");
else printf("NO\n");
}
}