题解 CF1337B 【Kana and Dragon Quest game】

· · 题解

题意:有一条生命为 x 的龙,你可以使用 a 次 A 操作,每一次可以使龙的生命值变为 x/2+10,b 次 B 操作,每次使龙的生命值减少 10。

贪心。

肯定先使用 A,操作,因为 x 越大 A 的伤害越大,但当 x<20 时,A 操作就没用了,有时反而会有副作用。

所以,先一直使用 A 操作直到 x<20,判断能否是用 B 操作获得胜利即可。

#include<cstdio>
#define re register
inline int read(){
    re int t=0;re char v=getchar();
    while(v<'0')v=getchar();
    while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
    return t;
}
int t,n,m,a,b,c,d;
int main(){
    t=read();
    while(t--){
        n=read();a=read();b=read();
        for(re int i=1;i<=a;++i)if(n/2+10>n)break;else n=n/2+10;
        if(b*10>=n)puts("YES");
        else puts("NO");
    }
}