S-Nim Time Limit: 2000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u Submit Status Description Arthur and his sister Caroll have been playing a game called Nim for some time now. Nim is played as follows: The starting position has a numb…
Chess Problem Description Alice and Bob are playing a special chess game on an n × 20 chessboard. There are several chesses on the chessboard. They can move one chess in one turn. If there are no other chesses on the right adjacent block of the mov…
Fibonacci again and again Problem Description 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的:F(1)=1;F(2)=2;F(n)=F(n-1)+F(n-2)(n>=3);所以,1,2,3,5,8,13……就是菲波那契数列.在HDOJ上有不少相关的题目,比如1005 Fibonacci again就是曾经的浙江省赛题.今天,又一个关于Fibonacci的题目出现了,它是一个小游戏,定义如下:1. …
Nim or not Nim? Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 3032 Description Nim is a two-player mathematic game of strategy in which players take turns removing objects from distinct heaps.…
题目 洛谷传送门 题解 打表找sgsgsg规律. 严谨证明见:纳尔的博客 CODE #include <bits/stdc++.h> using namespace std; int sg(int a, int b) { if(a&1 && b&1) return 0; return sg(a+1>>1, b+1>>1) + 1; } int main () { int T, n; scanf("%d", &T…
Stone Game II comes. It needs two players to play this game. There are some piles of stones on the desk at the beginning. Two players move the stones in turn. At each step of the game the player should do the following operations. First, choose a p…