摘要: 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 expelled fr 阅读全文
posted @ 2013-06-03 19:29 欧阳生朵 阅读(914) 评论(0) 推荐(2) 编辑
摘要: 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 may be som 阅读全文
posted @ 2013-06-02 20:38 欧阳生朵 阅读(292) 评论(0) 推荐(0) 编辑
摘要: 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 perform 阅读全文
posted @ 2013-06-01 15:31 欧阳生朵 阅读(1051) 评论(0) 推荐(0) 编辑
摘要: 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.— But look, 阅读全文
posted @ 2013-05-31 22:11 欧阳生朵 阅读(391) 评论(0) 推荐(0) 编辑
摘要: 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 file may 阅读全文
posted @ 2013-05-31 15:56 欧阳生朵 阅读(503) 评论(0) 推荐(0) 编辑
摘要: 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 teleporting 阅读全文
posted @ 2013-05-30 22:41 欧阳生朵 阅读(2114) 评论(0) 推荐(0) 编辑
摘要: 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 by solid 阅读全文
posted @ 2013-05-30 22:03 欧阳生朵 阅读(538) 评论(0) 推荐(0) 编辑
摘要: Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n当为-1 -1时表示输入结束。随后的n行描述了棋盘的形状:每行有n个字符,其中 # 表示棋盘区域, . 表示空白区域(数据保证不出现多余的空白行或者空白列)。Output对于每一组数据,给出 阅读全文
posted @ 2013-05-30 21:20 欧阳生朵 阅读(120) 评论(0) 推荐(0) 编辑
摘要: DescriptionOn Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is marked. They use only a single stone. The purpose of the game is to lead the stone from the s 阅读全文
posted @ 2013-05-30 20:43 欧阳生朵 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 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 chessboard he 阅读全文
posted @ 2013-05-29 21:39 欧阳生朵 阅读(199) 评论(0) 推荐(0) 编辑