正文内容加载中...
posted @ 2013-07-22 18:07 Tamara.c 阅读(172) 评论(2) 编辑
摘要: 转载请注明出自matrix67.com在所有8-bit的整数中,含有k个数字“1”的二进制数一共有C(8,k)个。给出其中的一个二进制数,你如何利用位运算快速找到下一个恰有k个“1”的数?例如,如果给你二进制数01011100,那么下一个(含4个“1”的)数就是01100011。在继续阅读下去之前,建议你仔细思考一下。你或许会想看看我很早以前写的一篇介绍位运算的文章。这是一道很好的题目,很多位运算技巧在这里都有体现。在草稿纸上随便举几个例子,规律很容易看出来。由于“1”的个数是固定的,为了让这个二进制数更大,我们必须把第一个出现在“1”左边的“0”改成“1”;同时,为了让这个二进制数尽可能小,阅读全文
posted @ 2013-04-22 13:44 Tamara.c 阅读(28) 评论(0) 编辑
摘要: DescriptionYou, as a member of a development team for a new spell checking program, are to write a module that will check the correctness of given words using a known dictionary of all correct words in all their forms.If the word is absent in the dictionary then it can be replaced by correct words (阅读全文
posted @ 2013-04-08 20:27 Tamara.c 阅读(34) 评论(0) 编辑
摘要: DescriptionA power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied with an amount s(u) >= 0 of power, may produce an amount 0 <= p(u) <= pmax(u) of power, may consume an amount 0 <= c(u) <= min(s(u),cma阅读全文
posted @ 2013-04-08 20:14 Tamara.c 阅读(44) 评论(0) 编辑
摘要: DescriptionThe Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most striking reason why they got the job, is their discovery of a new, highly noise resistant, antenna. It is called 4DAir, and comes in four types. Each type阅读全文
posted @ 2013-04-08 20:08 Tamara.c 阅读(16) 评论(0) 编辑
摘要: DescriptionBessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids (1 <= K <= 10,000), which are conveniently located at the lattice points of the grid.Fortunately, Bessie has a powerful weapon阅读全文
posted @ 2013-04-08 20:01 Tamara.c 阅读(29) 评论(0) 编辑
摘要: DescriptionWindy hasNballs of distinct weights from 1 unit toNunits. Now he tries to label them with 1 toNin such a way that:No two balls share the same label.The labeling satisfies several constrains like "The ball labeled withais lighter than the one labeled withb".Can you help windy to 阅读全文
posted @ 2013-04-03 12:45 Tamara.c 阅读(55) 评论(0) 编辑
摘要: DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequence A, B, C, D implies that A < B, B < C and C < D. in this problem, we will give you a set of re阅读全文
posted @ 2013-04-03 12:38 Tamara.c 阅读(28) 评论(0) 编辑
摘要: DescriptionFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course.Farmer John ordered a high speed connection for his farm and is going to share his connectivity with the other farmers. T阅读全文
posted @ 2013-04-03 12:34 Tamara.c 阅读(51) 评论(0) 编辑
摘要: DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of this problem. They're planning to build some highways so that it will be possible to drive between any pair of阅读全文
posted @ 2013-04-03 12:33 Tamara.c 阅读(26) 评论(0) 编辑