Luogu 题解 CF1337B 【Kana and Dragon Quest game】

原题妥妥的大水题

基本思路

  • 先进行 空洞吸收 的操作,得到加血后的血量;
while ((x/2+10)<=x && (n!=0))
{
	x = x/2+10;
	n--;
}
  • 而后判断 雷击 是否能将现在的龙击败;
if (m*10 >= x)
	printf("YES\n");
else
	printf("NO\n");

完整代码

#include <cstdio>

int T, x, n, m;

void input_calc_output()
{
	// input
	scanf("%d", &T);
	for (int i = 1; i <= T; i++)
	{ 
		scanf("%d %d %d", &x, &n, &m);
		// calc
		while ((x/2+10)<=x && (n!=0))
		{
			x = x/2+10;
			n--;
		}
	
		// output
		if (m*10 >= x)
			printf("YES\n");
		else
			printf("NO\n");
	} 
}

int main()
{
	input_calc_output();
	return 0;
}
posted @ 2020-04-20 12:14  Rnin  阅读(164)  评论(0)    收藏  举报