lightoj 1020 A Childhood Game 链接:http://lightoj.com/volume_showproblem.php?problem=1020 题意:一堆石子有 m 个,Alice和Bob可以从中取1个或者2个,如果Alice先取,最后取的人败:如果Bob先取,最后取的人胜.问胜利者. 思路:枚举前几个石子的情况,很容易找出每种情况的必败点,找规律.如果Alice先取,Alice的必败点为mod 3 == 1,如果Bob先取,Bob必败点在 mod 3 == 0处…
思路:很简单的博弈,找出每个人先拿的必胜态进行状态转移即可. #include<cstdio> #include<string> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int main(){ int t, n, CASE(0); char str[10]; scanf("%d", &t); while(…
A - Matrix Game Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit Status Description Given an m x n matrix, where m denotes the number of rows and n denotes the number of columns and in each cell a pile of stones is gi…
Jolly and Emily are two bees studying in Computer Science. Unlike other bees they are fond of playing two-player games. They used to play Tic-tac-toe, Chess etc. But now since they are in CS they invented a new game that definitely requires some know…
Alice and Bob are playing game of Misère Nim. Misère Nim is a game playing on k piles of stones, each pile containing one or more stones. The players alternate turns and in each turn a player can select one of the piles and can remove as many stones…
You are given an n x n chess board. Only pawn is used in the 'Incredible Chess' and they can move forward or backward. In each column there are two pawns, one white and one black. White pawns are placed in the lower part of the board and the black pa…