10 2013 档案

摘要:Problem DescriptionThere are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and only if there is a road between A and B, or there exists a village C such that there is a 阅读全文
posted @ 2013-10-31 20:52 persistent codeants 阅读(196) 评论(0) 推荐(0)
摘要:Problem DescriptionMr Wang wants some boys to help him with a project. Because the project is rather complex,the more boys come, the better it will be. Of course there are certain requirements.Mr Wang selected a room big enough to hold the boys. The boy who are not been chosen has to leave the room 阅读全文
posted @ 2013-10-31 18:51 persistent codeants 阅读(264) 评论(0) 推荐(0)
摘要:Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的设计图是否符合她的设计思路。比如下面的例子,前两个是符合条件的,但是最后一个却有两种方法从5到达8。Input输入包含多组数据,每组数据是一个以0 0结尾的整数对 阅读全文
posted @ 2013-10-31 16:46 persistent codeants 阅读(386) 评论(0) 推荐(0)
摘要:Problem DescriptionToday is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, and all the friends do not want to stay with strangers.One important rule 阅读全文
posted @ 2013-10-30 20:29 persistent codeants 阅读(246) 评论(0) 推荐(0)
摘要:Problem 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 阅读全文
posted @ 2013-10-30 19:46 persistent codeants 阅读(281) 评论(0) 推荐(0)
摘要:Problem Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其他的东西,他可以降低价格。探险家于是又跑到其他地方,其他人也提出了类似的要求,或者直接用金币换,或者找到其他东西就可以降低价格。不过探险家没必要用多样东 阅读全文
posted @ 2013-10-30 09:48 persistent codeants 阅读(334) 评论(0) 推荐(0)
摘要:Problem DescriptionYou have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how the strings are generated and inserted into the original message. 阅读全文
posted @ 2013-10-29 22:19 persistent codeants 阅读(296) 评论(0) 推荐(0)
摘要:Problem DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. For the input sequence9 1 0 5 4 ,Ultra-QuickSort produces the 阅读全文
posted @ 2013-10-29 11:39 persistent codeants 阅读(184) 评论(0) 推荐(0)
摘要:Problem DescriptionYou may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a collection of snowflakes, and search for a pair that may be identical. Each snowflake has six arms. For each sn 阅读全文
posted @ 2013-10-28 17:57 persistent codeants 阅读(262) 评论(0) 推荐(0)
摘要:Problem DescriptionFarmer John'sNcows (1 ≤N≤ 100,000) share many similarities. In fact, FJ has been able to narrow down the list of features shared by his cows to a list of onlyKdifferent features (1 ≤K≤ 30). For example, cows exhibiting feature #1 might have spots, cows exhibiting feature #2 mi 阅读全文
posted @ 2013-10-28 16:52 persistent codeants 阅读(260) 评论(0) 推荐(0)
摘要:Problem DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the stock market. For maximum effect, you have to spread the rumours in the fastest possible 阅读全文
posted @ 2013-10-28 13:49 persistent codeants 阅读(205) 评论(0) 推荐(0)
摘要:Problem DescriptionOrganizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satisfy the following two terms:1. All of the teams solve at least one problem.2. The champion (One of those teams that solve the most p 阅读全文
posted @ 2013-10-26 20:05 persistent codeants 阅读(229) 评论(0) 推荐(0)
摘要:Problem 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 2 #include 3 #include 4 #include 5 #include 6 using namespace ... 阅读全文
posted @ 2013-10-26 17:30 persistent codeants 阅读(215) 评论(0) 推荐(0)
摘要:Problem DescriptionConsider equations having the following form:a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0The coefficients are given integers from the interval [-50,50].It is consider a solution a system (x1, x2, x3, x4, x5) that verifies the equation, xi∈[-50,50], xi != 0, any i∈{1,2,3,4,5}.Determine how 阅读全文
posted @ 2013-10-26 15:07 persistent codeants 阅读(259) 评论(0) 推荐(0)
摘要:Problem DescriptionA square is a 4-sided polygon whose sides have equal length and adjacent sides form 90-degree angles. It is also a polygon such that rotating about its centre by 90 degrees gives the same polygon. It is not the only polygon with the latter property, however, as a regular octagon a 阅读全文
posted @ 2013-10-26 13:03 persistent codeants 阅读(233) 评论(0) 推荐(0)
摘要:Problem DescriptionThis problem is based on an exercise of David Hilbert, who pedagogically suggested that one study the theory of4n+1numbers. Here, we do only a bit of that.AnH-number is a positive number which is one more than a multiple of four: 1, 5, 9, 13, 17, 21,... are theH-numbers. For this 阅读全文
posted @ 2013-10-26 11:06 persistent codeants 阅读(154) 评论(0) 推荐(0)
摘要:Problem DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.InputInput consists of up to 100,000 dictionary entries, followed by a blank line, followed by a 阅读全文
posted @ 2013-10-25 13:04 persistent codeants 阅读(269) 评论(0) 推荐(0)
摘要:Problem DescriptionA single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2...Sk. Each group Sk consists of a sequence of positive integer numbers ranging from 1 to k, written one after another.For example, the first 80 d 阅读全文
posted @ 2013-10-23 18:53 persistent codeants 阅读(196) 评论(0) 推荐(0)
摘要:Problem 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 阅读全文
posted @ 2013-10-22 21:46 persistent codeants 阅读(159) 评论(0) 推荐(0)
摘要:Problem DescriptionConsider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901).InputThe only line contains the two natural numbers A and B, (0 2 #include 3 #include 4 5 #define SIZE_N 10000 6 #define MODE 99.. 阅读全文
posted @ 2013-10-22 21:09 persistent codeants 阅读(339) 评论(0) 推荐(0)
摘要:Problem DescriptionA Compiler Mystery: We are given a C-language style for loop of typefor (variable = A; variable != B; variable += C) statement;I.e., a loop which starts by setting variable to value A and while variable is not equal to B, repeats statement followed by increasing the variable by C. 阅读全文
posted @ 2013-10-22 09:03 persistent codeants 阅读(241) 评论(0) 推荐(0)
摘要:Problem DescriptionFarmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤moneyi≤ 10,000) that he will need to spend each day over the nextN(1 ≤N≤ 100,000) days.FJ wants to create 阅读全文
posted @ 2013-10-21 15:31 persistent codeants 阅读(211) 评论(0) 推荐(0)
摘要:Problem DescriptionEvery year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The excitement takes place on a long, straight river with a rock at the start and another rock at the end,Lunits away from the start (1 ≤L≤ 1,0 阅读全文
posted @ 2013-10-21 14:57 persistent codeants 阅读(186) 评论(0) 推荐(0)
摘要:Problem DescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilization. Each Borg individual is linked to the collective by a sophisticated subspace netwo 阅读全文
posted @ 2013-10-20 16:14 persistent codeants 阅读(165) 评论(0) 推荐(0)
摘要:Problem 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 fa 阅读全文
posted @ 2013-10-20 13:29 persistent codeants 阅读(239) 评论(0) 推荐(0)
摘要:Problem DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing each type of a truck. The code is simply a string of exactly seven lowercase letters (each letter 阅读全文
posted @ 2013-10-20 09:13 persistent codeants 阅读(181) 评论(0) 推荐(0)
摘要:Problem DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sunscreen, he wants to avoid swimming and instead reach her by jumping.Unfortuna 阅读全文
posted @ 2013-10-19 20:02 persistent codeants 阅读(290) 评论(0) 推荐(0)
摘要:Problem DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE you entered the wormhole! Each of FJ's farms comprisesN(1 ≤N≤ 500) f 阅读全文
posted @ 2013-10-19 17:11 persistent codeants 阅读(251) 评论(0) 推荐(0)
摘要:Problem DescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There can be several points specializing in the same pair of currencies. Each point has it 阅读全文
posted @ 2013-10-19 16:28 persistent codeants 阅读(264) 评论(0) 推荐(0)
摘要:Problem DescriptionWhen a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L, where C is the coefficient of heat expansion.When a thin rod is mounted on two solid walls and then heated, it expands and takes the shape of a circular segment, the original rod being th 阅读全文
posted @ 2013-10-19 15:12 persistent codeants 阅读(245) 评论(0) 推荐(0)
摘要:Problem DescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This should be one piece of one pie, not several sm 阅读全文
posted @ 2013-10-19 12:33 persistent codeants 阅读(249) 评论(0) 推荐(0)
摘要:Problem DescriptionYou have just been put in charge of developing a new shredder for the Shredding Company Although a "normal" shredder would just shred sheets of paper into little pieces so that the contents would become unreadable, this new shredder needs to have the following unusual ba 阅读全文
posted @ 2013-10-19 09:59 persistent codeants 阅读(208) 评论(0) 推荐(0)
摘要:Problem DescriptionSuppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S matrix with the rows and columns numbered from 0 to S-1. Each square contains a base station. The number of active mobi 阅读全文
posted @ 2013-10-18 09:20 persistent codeants 阅读(156) 评论(0) 推荐(0)
摘要:Problem DescriptionBackgroundProfessor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender. In his experiment, individual bugs and their interactions were easy to identify 阅读全文
posted @ 2013-10-17 22:04 persistent codeants 阅读(251) 评论(0) 推荐(0)
摘要:Problem DescriptionSudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 to 9. The other cells are empty. The goal is to fill the empty cells with decimal digits from 1 阅读全文
posted @ 2013-10-16 20:43 persistent codeants 阅读(541) 评论(0) 推荐(0)
摘要:Problem DescriptionA common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips,S1andS2, each stack containingCchips. Each stack may contain chips of several different colors.The actual shuffle operation is 阅读全文
posted @ 2013-10-16 19:16 persistent codeants 阅读(357) 评论(0) 推荐(0)
摘要:Problem DescriptionBeing a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress, and drinking with the other knights are fun things to do. Therefore, it is not very surprising that in recent years the kingdom of King Arthur has experienced an unprecedented inc 阅读全文
posted @ 2013-10-16 17:00 persistent codeants 阅读(258) 评论(0) 推荐(0)
摘要:Problem DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.— It is a matter of security to change such things every now and then, to keep the enemy in the dark.— Bu 阅读全文
posted @ 2013-10-15 17:24 persistent codeants 阅读(202) 评论(0) 推荐(0)
摘要:Problem DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonally and the maze is surrounded b 阅读全文
posted @ 2013-10-14 21:42 persistent codeants 阅读(220) 评论(0) 推荐(0)
摘要:Problem DescriptionThe cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through the maze facing zombies, chainsaw-wielding psychopaths, hippies, and other terrors on their quest to find the exit.One popular maze-walking strategy guarantees that the visitor 阅读全文
posted @ 2013-10-14 19:58 persistent codeants 阅读(197) 评论(0) 推荐(0)
摘要:Problem DescriptionIt's almost summer time, and that means that it's almost summer construction time! This year, the good people who are in charge of the roads on the tropical island paradise of Remote Island would like to repair and upgrade the various roads that lead between the various to 阅读全文
posted @ 2013-10-12 18:05 persistent codeants 阅读(235) 评论(0) 推荐(0)
摘要:Problem DescriptionA university network is composed of N computers. System administrators gathered information on the traffic between nodes, and carefully divided the network into two subnetworks in order to minimize traffic between parts.A disgruntled computer science student Vasya, after being exp 阅读全文
posted @ 2013-10-12 16:08 persistent codeants 阅读(166) 评论(0) 推荐(0)
摘要:Problem DescriptionYou are given two pots, having the volume ofAandBliters respectively. The following operations can be performed:FILL(i) fill the poti(1 ≤i≤ 2) from the tap;DROP(i) empty the potito the drain;POUR(i,j) pour from potito potj; after this operation either the potjis full (and there ma 阅读全文
posted @ 2013-10-12 12:46 persistent codeants 阅读(244) 评论(0) 推荐(0)
摘要:DescriptionEverybody is fond of computers, but buying a new one is always a money challenge. Fortunately, there is always a convenient way to deal with. You can replace your computer and get a brand new one, thus saving some maintenance cost. Of course, you must pay a fixed cost for each new compute 阅读全文
posted @ 2013-10-12 10:48 persistent codeants 阅读(280) 评论(0) 推荐(0)
摘要:DescriptionDearboy was so busy recently that now he has piles of clothes to wash. Luckily, he has a beautiful and hard-working girlfriend to help him. The clothes are in varieties of colors but each piece of them can be seen as of only one color. In order to prevent the clothes from getting dyed in 阅读全文
posted @ 2013-10-12 09:21 persistent codeants 阅读(185) 评论(0) 推荐(0)
摘要:Problem DescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more than 100 decimal digits.InputThe input f 阅读全文
posted @ 2013-10-11 21:52 persistent codeants 阅读(619) 评论(0) 推荐(0)
摘要:Problem DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a pointN(0 ≤N≤ 100,000) on a number line and the cow is at a pointK(0 ≤K≤ 100,000) on the same number line. Farmer John has two modes of transportation: walking and tel 阅读全文
posted @ 2013-10-11 21:12 persistent codeants 阅读(166) 评论(0) 推荐(0)
摘要:Problem Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 char map[1001][1001]; 8 int vis[1001. 阅读全文
posted @ 2013-10-11 20:38 persistent codeants 阅读(212) 评论(0) 推荐(0)
摘要:Problem DescriptionBackgroundThe knight is getting bored of seeing the same black and white squares again and again and has decided to make a journeyaround the world. Whenever a knight moves, it is two squares in one direction and one square perpendicular to this. The world of a knight is the chessb 阅读全文
posted @ 2013-10-10 21:18 persistent codeants 阅读(286) 评论(0) 推荐(0)
摘要:Problem DescriptionIt is year 2500 A.D. and there is a terrible war between the forces of the Earth and the Mars. Recently, the commanders of the Earth are informed by their spies that the invaders of Mars want to land some paratroopers in them×ngrid yard of one their main weapon factories in o 阅读全文
posted @ 2013-10-10 19:03 persistent codeants 阅读(278) 评论(0) 推荐(0)
摘要:When we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this time, we may call for food delivery.Suppose there areNpeople living in a straight street that is just lies on an X-coordinate axis. Theithperson's coordinate isXimeters 阅读全文
posted @ 2013-10-09 13:08 persistent codeants 阅读(343) 评论(0) 推荐(0)
摘要:DescriptionHumans have discovered a kind of new metal mineral on Mars which are distributed in point�like with paths connecting each of them which formed a tree. Now Humans launches k robots on Mars to collect them, and due to the unknown reasons, the landing site S of all robots is identified in ad 阅读全文
posted @ 2013-10-07 12:46 persistent codeants 阅读(165) 评论(0) 推荐(0)
摘要:DescriptionAfter months of hard working, Iserlohn finally wins awesome amount of scholarship. As a great zealot of sneakers, he decides to spend all his money on them in a sneaker store.There are several brands of sneakers that Iserlohn wants to collect, such as Air Jordan and Nike Pro. And each bra 阅读全文
posted @ 2013-10-06 19:19 persistent codeants 阅读(182) 评论(0) 推荐(0)
摘要:DescriptionAfter months of hard working, Iserlohn finally wins awesome amount of scholarship. As a great zealot of sneakers, he decides to spend all his money on them in a sneaker store.There are several brands of sneakers that Iserlohn wants to collect, such as Air Jordan and Nike Pro. And each bra 阅读全文
posted @ 2013-10-06 19:17 persistent codeants 阅读(182) 评论(0) 推荐(0)
摘要:DescriptionThe cows are going to space! They plan to achieve orbit by building a sort of space elevator: a giant tower of blocks. They have K (1 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int dp[500010],i,j,k; 8 int n; 9 struct ds10 {11 int a,h,c;12 }e[500001];13 bool ... 阅读全文
posted @ 2013-10-06 13:24 persistent codeants 阅读(267) 评论(0) 推荐(0)
摘要:Problem DescriptionEvery cow's dream is to become the most popular cow in the herd. In a herd of N (1 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int dfn[10011],low[10011],vec[100011],nxt[1110001],id[10011],sta[1000111],head[11001],vis[11001],num[11001],in[11001]; 8 int 阅读全文
posted @ 2013-10-06 11:26 persistent codeants 阅读(244) 评论(0) 推荐(0)
摘要:Problem DescriptionOn a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little man, you need to pay a $1 travel fee for every step he moves, until he enters a house. The task 阅读全文
posted @ 2013-10-05 19:26 persistent codeants 阅读(209) 评论(0) 推荐(0)
摘要:Problem DescriptionDearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from him.Dearboy has M supply places (marked from 1 to M), each provides K different kinds of goods (marked from 1 to K) 阅读全文
posted @ 2013-10-05 17:48 persistent codeants 阅读(221) 评论(0) 推荐(0)
摘要:Problem DescriptionThe galaxy war between the Empire Draco and the Commonwealth of Zibu broke out 3 years ago. Draco established a line of defense called Grot. Grot is a straight line withNdefense stations. Because of the cooperation of the stations, Zibu’s Marine Glory cannot march any further but 阅读全文
posted @ 2013-10-05 12:08 persistent codeants 阅读(209) 评论(0) 推荐(0)
摘要:Problem DescriptionYou are given n closed, integer intervals [ai, bi] and n integers c1, ..., cn.Write a program that:reads the number of intervals, their end points and integers c1, ..., cn from the standard input,computes the minimal size of a set Z of integers which has at least ci common element 阅读全文
posted @ 2013-10-05 08:44 persistent codeants 阅读(235) 评论(0) 推荐(0)
摘要:Problem DescriptionIn a modernized warehouse, robots are used to fetch the goods. Careful planning is needed to ensure that the robots reach their destinations without crashing into each other. Of course, all warehouses are rectangular, and all robots occupy a circular floor space with a diameter of 阅读全文
posted @ 2013-10-04 19:08 persistent codeants 阅读(213) 评论(0) 推荐(0)