Soma is a fashionable girl. She absolutely loves shiny stones that she can put on as jewellery accessories. She has been collecting stones since her childhood - now she has become really good with ide...
分类:
其他好文 时间:
2014-05-07 07:38:20
阅读次数:
415
The Little Elephant likes permutations. This time he has a permutation A[1], A[2], ..., A[N] of numbers 1, 2, ...,N.
He calls a permutation A good, if the number of its inversions is equal to the n...
分类:
其他好文 时间:
2014-05-07 07:20:50
阅读次数:
356
找出一个数组中的三个数,三个数不能组成三角形。
三个数不能组成三角形的条件是:a + b
两边和小于第三边。
这个问题属于三个数的组合问题了。暴力法可解,但是时间效率就是O(n*n*n)了,很慢。
不过既然是组合问题就必定可以使用排序后处理的方法降低时间效率的。
这里降低时间效率的方法是:
选一个最大的数c,然后选两个小数a和b,其中a
这样可以把时间效率降到O(n*n)...
分类:
其他好文 时间:
2014-05-07 06:32:23
阅读次数:
289
One evening Johnny found some funny looking beens in his grandfather's garden shed, and decided to plant one of them. Next morning, to his surprise he found an enormous beanstalk growing in his back y...
分类:
其他好文 时间:
2014-05-07 05:17:42
阅读次数:
303
Popular Rice Recipe
Did you know that there are over 40,000 varieties of Rice in the world ? There are so many dishes that can be prepared with Rice too. A famous chef from Mumbai, Tid Gusto prep...
分类:
其他好文 时间:
2014-05-07 04:05:46
阅读次数:
428
Subtraction Game 1
Chef is playing a game on a sequence of N positive integers, say A1, A2, ... AN. The game is played as follows.
If all the numbers are equal, the game ends.Otherwise
Sele...
分类:
其他好文 时间:
2014-05-07 03:14:01
阅读次数:
280
Chef develops his own computer program for playing chess. He is at the very beginning. At first he needs to write the module that will receive moves written by the players and analyze it. The module w...
分类:
其他好文 时间:
2014-05-06 23:11:26
阅读次数:
497
Maximum Weight Difference
Chef has gone shopping with his 5-year old son. They have bought N items so far. The items are numbered from 1 to N, and the item i weighs Wi grams.
Chef's son insist...
分类:
其他好文 时间:
2014-05-06 22:59:49
阅读次数:
451
You are given an N × N grid initially filled by zeros. Let the rows and columns of the grid be numbered from1 to N, inclusive. There are two types of operations can be applied to the grid:
RowAdd R...
分类:
其他好文 时间:
2014-05-06 22:35:44
阅读次数:
451
A cricket team consists of 11 players and some are good at batting, others are good at bowling and some of them are good at both batting and bowling. The batting coach wants to select exactly K player...
分类:
其他好文 时间:
2014-05-06 22:23:32
阅读次数:
421