2021ICPC江西省赛 H Hearthstone So Easy

H. Hearthstone So Easy

时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 262144K,其他语言524288K

Hearthstone is a turn-based card game. The game flow of each round is: Player 1 draws card ⇒ player 1 plays cards ⇒ player 2 draws card ⇒ player 2 plays cards.

We simplify the game logic as follows:

  • During each player’s draw stage, the player attempts to draw a card from his or her deck.
  • During each player’s playing stage, the player can choose:
  1. to increase his/her health by k points. Note that there is no upper limit on health.
  2. to reduce the opponent’s health by k points.

​ When there are no cards in the player’s card deck, the player will enter a state of fatigue. At this time, the player will increase his/her fatigue value by one every times he/she tries to draw a card, and then deduct the amount of health by th****e fatigue value. The fatigue value of each player is initially 000 points.

pllj and freesin like playing hearthstone very much. In a certain game, both players have no cards in their decks, and both the fatigue points are 000 points, and the health points are both n points. When a player’s health is less than or equal to 000, the player immediately loses the game.

​ At this time, it’s pllj’s turn to draw card. Both players are very smart, so they play the game optimally. Who will be the winner? Please output his name.

输入描述:

The first line contains a single integer t (1≤t≤10^5), which represents the number of data cases.
Each test case is one line containing two positive integers n,k(1≤n,k≤10^9)separated by one whitespace, of which meaning is described before.

输出描述:

For each case of data, output a line of string pllj or freesin to indicate the winner.

Tag: math

Difficulty:5/10


思路:

​ 有一点博弈的思想在里面,首先我们可以想到有四种情况: A加血, B也加血(情况一)、A打B B加血(情况二)、A加血 B打A(情况三)、A打B B打A(情况四); 因为A和B都是相同的血量,所以我们可以发现情况一和四拖疲劳的话肯定是A输(A是先手),而且因为A先吃疲劳,A必然会被B先打死 ; 所以A唯一的赢面就在于能否第一回合斩杀B,否则都是B赢。当然,记得特判只有1血时,A直接暴毙。

AC代码:

#include <iostream>

using namespace std;

int t;

int main() {
	cin >> t;
	while (t --) {
		int n, k;
		cin >> n >> k;
		if (n == 1)  cout << "freesin" << endl;
		else if (1 + k >= n)  cout << "pllj" << endl;
		else  cout << "freesin" << endl;
	}
	return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 2021年江西省大学生程序设计竞赛是一项针对大学生的编程竞赛活动。该竞赛旨在提高大学生的编程能力和创新思维,促进计算机科学技术的发展和应用。竞赛内容包括算法设计、程序实现、数据结构等方面,参赛选手需要在规定时间内完成指定的编程任务。这是一项非常有挑战性和有意义的竞赛,对于提高大学生的编程水平和实践能力有很大的帮助。 ### 回答2: 2021年3月14日,江西省大学生程序设计竞赛(ICPC)在江西师范大学举行。本次比赛由江西省计算机学会主办,吉林大学博爱学院赞助,共有15支队伍参赛,此次比赛的主要目的是提高学生们的程序设计与算法能力,同时为江西省选出优秀的程序设计人才。 比赛采用ACM国际竞赛的形式,共有12个题目,考察了参赛选手在算法设计、程序实现、数据结构、编程能力等方面的综合素质。比赛时间长达5个小时,选手需要在规定时间内完成尽可能多的题目,并在保证正确性的同时尽量节省时间。 2019年江苏省大学生程序设计竞赛的比赛题分别从算法设计基础、计算几何、动态规划、搜索、数据结构等方面出题,难度适中。所有参赛队伍均在赛场上充分展示了自己的才华和程序设计能力,赛场上紧张的气氛、激烈的角逐使得比赛更加刺激和有趣。 此次比赛从选拔、组织、管理等方面是非常成功的,既展示了江西省大学生程序设计的风采,也为江西省和国家培养了更多的优秀程序设计人才。希望在未来的竞赛中,江西省程序设计的水平能够更上一层楼,培养更多的优秀程序设计人才。 ### 回答3: 2021年江西省大学生程序设计竞赛于2021年11月7日在南昌大学体育馆举行,来自江西省内的30多所高校的近500支队伍参赛。本次比赛分为省赛和校内赛两个阶段,对参赛队伍进行初步筛选和终极评选。 比赛分为解决8道问题的组成员和4道问题的单人组成员两部分,涵盖了计算几何、动态规划、图论、计算几何等多个领域,难度较高。比赛中,每个队伍有5个小时的时间解决问题,只能在计算机上编写代码解决问题,考验了参赛者的编程实力和团队协作能力。 比赛期间,裁判们在场内设立了各种问题的试题,比如“手工奶酪&rdquo;、“最大独立集&rdquo;、“调色板&rdquo;等,每个问题都要求参赛者在规定时间内精确解决。裁判们在以上操作的基础上,继续引入了随机性、收缩性和对称性等要素,使比赛题目更具挑战性。 本次比赛的成功举办,标志着江西省程序设计竞赛赛事的正式起航,并为江西省内高校的程序设计爱好者提供了一个互相交流、共同提高的平台。同时,也为将来江西省大学生程序设计竞赛的举办打下了坚实的基础。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值