Codeforces Round #635 (Div. 2) 比赛人数14830
[codeforces 1337B] Kana and Dragon Quest game 公式推导
总目录详见https://blog.csdn.net/mrcrack/article/details/103564004
在线测评地址https://codeforces.com/contest/1337/problem/B
Problem | Lang | Verdict | Time | Memory |
---|---|---|---|---|
B - Kana and Dragon Quest game | GNU C++17 | Accepted | 31 ms | 0 KB |
Void Absorption,Lightning Strike两种打击,选哪一个。
h/2+10=h-10,可得h=40
在h=40时,两种打击效果是一致的。
h>40,Void Absorption打击效果占优
h<40,Lightning Strike打击效果占优
突然发现,上述推导对解题没有帮助,那就继续。
h/2+10=h,h=20,Void Absorption丧失打击效果,
换一句话说,h>20时,Void Absorption有用,
h<=20时,Void Absorption无用
h-10=h,任何情况下,都无解,换一句话说,Lightning Strike在任何情况下,都有打击效果。
思路就出来了,h>20时,使用Void Absorption;h<=20时,使用Lightning Strike
AC代码如下
#include <stdio.h>
int main(){
int t,x,n,m;
scanf("%d",&t);
while(t--){
scanf("%d%d%d",&x,&n,&m);
while(x>20&&n)n--,x=x/2+10;
while(x>0&&m)m--,x-=10;
if(x>0)printf("NO\n");
else printf("YES\n");
}
return 0;
}