Where a, b, n, m are positive integers.┌x┐is the ceil of x. For example, ┌3.14┐=4. You are to calculate Sn. You, a top coder, say: So easy! Input There are several test cases, each test case in one line contains four positive integers: a, b, n, m.
P. T. Tigris is a student currently studying graph theory. One day, when he was studying hard, GS appeared around the corner shyly and came up with a problem:Given a graph with n nodes and m undirected weighted edges, every node having one of two
Alice and Bob's game never ends. Today, they introduce a new game. In this game, both of them have N different rectangular cards respectively. Alice wants to use his cards to cover Bob's. The card A can cover the card B if the height of A is not
The Ghost Blows LightTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1606 Accepted Submission(s): 490Problem DescriptionMy name is Hu Bayi, robing an ancient tomb in Tibet. The tomb consists
Balancing ActTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7412 Accepted: 2994DescriptionConsider a tree T with N (1 <= N <= 20,000) nodes numbered 1...N. Deleting any node from the tree yields a forest: a collection of one or more
Tree ConstructionTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 684 Accepted Submission(s): 364Problem DescriptionConsider a two-dimensional space with a set of points (xi, yi) that satisfy
Imagine you are standing inside a two-dimensional maze composed of square cells which may or may not be filled with rock. You can move north, south, east or west one cell at a step. These moves are called walks. One of the empty cells contains a box
Ignatius and the Princess ITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9433 Accepted Submission(s): 2784Special JudgeProblem DescriptionThe Princess has been abducted by the BEelzebub
Consider the classic random walk: at each step, you have a 1/2 chance of taking a step to the left and a 1/2 chance of taking a step to the right. Your expected position after a period of time is zero; that is, the average over many such random
A windmill animation works as follows:A two-dimensional set of points, no three of which lie on a line is chosen. Then one of the points is chosen (as the first pivot) and a line is drawn through the chosen point at some initial angle. The animation