my problems used in TopCoder SRMs

Hard: Chess Training

Alice and Bob are hobby chess players. They would like to become the best in the world so they are training a lot. Today they are going to play the following game with queens on a 100 x 100 chessboard to improve their offensive skills. In each turn a player must choose one queen and move with...

Medium: School Trip

There are n students standing in a circle and playing a game with a ball. The students are numbered from 0 to n-1 in clockwise order. On each turn, a student must take the ball and throw it at another student in the circle. Student i has a probability[i] percent chance of hitting the target...

Medium: Power Game

Alan and Bob are playing a game with two piles of sticks. The two players alternate turns, and Alan gets the first turn. During each turn, the player must remove exactly n^2 sticks from each pile, where n is some positive integer. The value of n does not have to be the same for each pile. For...

Hard: P-Sequence

You are given a int[] S containing a set of distinct integers. A sequence is called a p-sequence of S if it satisfies both of the following conditions: 1. It contains each element of S exactly once. 2. For each pair of consecutive sequence elements s1 and s2, (s1 - s2) is not divisible by...

Medium: Locate Treasure

Your crew of treasure hunters have recently found a very old map with instructions on how to find the treasure of an old civilization. There is a variable named Gold number, and it is initially assigned a value of 1. You are currently standing at position (0, 0), facing north.   First of all...

Medium: Teaching

A language teacher in Antarctica wants his students to be able to read as many words as possible. However, he only has time to teach them K letters. After that, the students will only be able to read words containing only those K letters. Your task is to determine which K letters should be taught...

Easy: Library

Mr. Agent has entered a government library where secret documents are stored. Documents are stored in different rooms, and each document has a list of user groups that can access it. In order to access a document, a person must have access to the room in which the document is stored and also be a...

Very easy: Love Calculator

A girl would like to go out with one of her favorite boys, but she does not know which one to choose. Fortunately, she has a Love Calculator which can calculate the probability of love between two people. Love Calculator takes two people's names and uses the following algorithm to calculate the...