题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2463
如图,对于每一步,都可一看成从1*2的骨牌的一段一道另一端,先手的人的路径是一系列1*2的骨牌的组合,那么能否赢就要看能否用1*2的骨牌完全覆盖即可
当n为偶数时,先手的一定有路走,所以可以赢,当n为奇数时,后手被带入必赢局,所以先手会输
贴代码
var n:longint;
begin
// assign(input,'2463.in');reset(input);
// assign(output,'2463.out');rewrite(output);
readln(n);
while n<>0 do
begin
if n and 1=0 then writeln('Alice')
else writeln('Bob');
readln(n);
end;
// close(input);close(output);
end.
【写的有漏洞的,欢迎路过大神吐槽】
2016/12/20 20:01:51
Ending.