[poj2234]Matches Game

Matches Game
Time Limit: 1000MS  Memory Limit: 65536K
Total Submissions: 5114  Accepted: 2874

Description

Here is a simple game. In this game, there are several piles of matches and two players. The two player play in turn. In each turn, one can choose a pile and take away arbitrary number of matches from the pile (Of course the number of matches, which is taken away, cannot be zero and cannot be larger than the number of matches in the chosen pile). If after a player’s turn, there is no match left, the player is the winner. Suppose that the two players are all very clear. Your job is to tell whether the player who plays first can win the game or not.
Input

The input consists of several lines, and in each line there is a test case. At the beginning of a line, there is an integer M (1 <= M <=20), which is the number of piles. Then comes M positive integers, which are not larger than 10000000. These M integers represent the number of matches in each pile.
Output

For each test case, output "Yes" in a single line, if the player who play first will win, otherwise output "No".
Sample Input

2 45 45
3 3 6 9

Sample Output

No
Yes

Source

POJ Monthly,readchild

 

题意:

给出n堆火柴棒,第i堆有a[i]根火柴棒.两个人轮流取.每人每次只能从某一堆中取若干根火柴棒,问先手能否有必胜的策略.

分析:

首先显而易见的是,由于玩家都不是2...所以若先手无必胜策略,则必输.

考虑n个数的异或和,即sum=a[1] xor a[2] xor a[3] xor ... xor a[n] ;

显然,当sum大于0时,先手可以取走某一堆中的若干根火柴使得sum=0;此后每次后手取火柴后,sum又会大于0,先手又能使得sum>0;

如此反复,后手总面对sum=0的情况,所以后手也会面对火柴总数为0的情况.

反之,当sum等于0时,先手必输.

内容概要:本文详细介绍了计算机求职面试的内容、技巧和备战策略,涵盖技术面、项目面、行为面三大部分。技术面重点在于算法和计算机基础知识,包括操作系统、网络、数据库等方面,并强调掌握高频算法题的解题方法和技巧。项目面要求候选人能够提炼项目的深度与亮点,运用STAR法则结构化描述项目经历,突出技术难点和解决方案。行为面主要考察候选人的软实力,如沟通能力、团队协作和解决问题的能力。高效备战策略方面,建议分阶段复习,优化简历,利用各种资源进行模拟面试。实战技巧部分提供了沟通心态管理、白板代码实战以及薪资谈判的具体指导。最后,文章还指出了常见误区,如盲目刷题、过度包装项目和忽视非技术问题的回答。 适合人群:计算机专业的应届毕业生和有工作经验的求职者,特别是希望进入互联网大厂、外企或独角兽企业的技术人员。 使用场景及目标:①帮助求职者理解计算机岗位面试的核心内容和技术要求;②提供系统的备考计划和资源推荐,提高面试准备效率;③传授面试实战技巧,增强求职者的自信心和表现力;④提醒求职者避免常见误区,确保面试过程顺利。 阅读建议:本文内容详实,建议读者按照文中提供的步骤逐步实施,结合自身实际情况调整策略。同时,注重实践练习,多参与模拟面试,不断总结经验教训,以提升面试成功率。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值