跳到正文

题解

题解 CF1337B 【Kana and Dragon Quest game】

gyh20约 1 分钟
原文
文章信息与版本

文章信息

收录
2026年6月14日
更新
2026年6月14日
篇幅
约 1 分钟
题目
CF1337B

版本

  1. v1当前

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

贪心。

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

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

C++
#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");
	}
}
原文