原创 Order Crossover

Description The procedure of Order Crossover (OX) applied in the Genetic Algorithm is as follows. 1. Select a substring

原创 1134積木分發

Constraints Time Limit: 10 secs, Memory Limit: 32 MB Description 歌手The Pancakes到幼兒園跟小朋友玩耍,她到達的時候小朋友們已經爭着積木玩了。小朋友都想要更多的積

原创 無路可逃?

Description 唐僧被妖怪關在迷宮中。孫悟空好不容易找到一張迷宮地圖,並通過一個魔法門來到來到迷宮某個位置。假設迷宮是一個n*m的矩陣,它有兩種地形,1表示平地,0表示沼澤,孫悟空只能停留在平地上。孫悟空目前的位置在座標(sx,s

原创 Inversion Number

Description There is a permutation P with n integers from 1 to n. You have to calculate its inversion number, which is

原创 Tiling a Grid With Dominoes

Description We wish to tile a grid 4 units high and N units long with rectangles (dominoes) 2 units by one unit (in eit

原创 生成字符串

Description 假設一個字符串只由字符‘0’,‘1’,‘?’組成,其中字符‘?’表示該字符可由字符‘0’或‘1’替代。 現有一些字符串,根據這些字符串生成所有可生成的字符串。 如:{10,?1,0? }可生成{10,01,11,0

原创 Pythagorean Proposition

Description One day, WXYZ got a wooden stick, he wanted to split it into three sticks and make a right-angled triangle.

原创 Greatest Common Divisors

Description A common divisor for two positive numbers is a number which both numbers are divisible by. It's easy to cal

原创 Funny Game

Description   Two players, Singa and Suny, play, starting with two natural numbers. Singa, the first player, subtracts

原创 Threecolor Problem

Description  有紅黃藍3種顏色的n個珠子,師傅希望悟空把它們排成紅色珠子在左,黃色珠子居中,藍色珠子在右的一行,然後告訴師傅,從左數起,第m個珠子是什麼顏色。衆所周知,悟空是隻猴子,他沒有這個耐心,你幫幫他吧。 Input 輸

原创 Polynomial

Description  Given a polynomial and the value of the variable x, you task is to calculate the value of the polynomial.

原创 396 Rotate Function

396 Rotate Function Given an array of integers A and letn to be its length. Assume Bk to be an array obtained by rotat

原创 1135飛越原野

Description 勇敢的德魯伊法里奧出色的完成了任務之後,正在迅速的向自己的基地撤退。但由於後面有着一大羣追兵,所以法里奧要儘快地返回基地,否則就會被敵人捉住。 終於,法里奧來到了最後的一站:泰拉希爾原野,穿過這裏就可以回到基地了。

原创 Brackets Matching

Description Let us define a regular brackets sequence in the following way: 1. Empty sequence is a regular sequence. 2.

原创 1438Shopaholic

Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description Lindsay is a shopaholic. Whenever there is a discount o