上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 17 下一页
摘要: 【题目描述】一个众所周知的事实,在每一慧星后面是一个不明飞行物UFO。这些不明飞行物时常来收集来自在地球上忠诚的支持者。不幸地,他们的飞碟在每次旅行只能带上一定数目的支持者。 他们要做的是用一种聪明的方案让每一个团体人被慧星带走。他们为每个慧星起了一个独有名字,通过这些名字来决定一个团体是不是特定的慧星带走。 那个相配方案的细节在下面被给出;你的工作要写一个程序来通过团体的名字和彗星的名字来决定一个组是否应该与在那一颗慧星后面的不明飞行物搭配。团体的名字和慧星的名字都以下列各项方式转换成一个数字: 这个最后的数字代表名字中所有字母的信息,"A" 是1 和 "Z&q 阅读全文
posted @ 2012-04-20 07:19 'wind 阅读(401) 评论(0) 推荐(0) 编辑
摘要: Description给出一个有向带权图G,针对该图有如下的两种操作:(1)标记该图的一个点(2)找到两点间的只通过已标记点的最短路径长度输入:输入包括多组测试,每组测试中第一行包括三个整数N,M,Q,N表示图中的节点数量,N<=300,M表示边的数量,M<=100000;Q表示执行多少次操作,Q<=100000,所有点被编号为0,1,2,...,N-1,最初所有的点都是未标记的,接下来M行每行包括三个整数x,y,c,表示从x到y有一条边长度为c,c>0,然后为Q行,每行表示一次操作,0 x表示将点x标记,1 x y表示查找x到y的只通过已标记点的最短路径长度,N=M= 阅读全文
posted @ 2012-04-20 00:11 'wind 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 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 many sol 阅读全文
posted @ 2012-04-19 16:28 'wind 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionA school bought the first computer some time ago(so this computer's id is 1). During the recent years the school bought N-1 new computers. Each new computer was connected to one of settled earlier. Managers of school are anxious about slow functioning of the net and want to kn 阅读全文
posted @ 2012-04-18 22:14 'wind 阅读(353) 评论(0) 推荐(0) 编辑
摘要: DescriptionLeyni喜欢机器人,这次,他得到了一个机器人,这个机器人能接受两种命令,"T"(向后转),"F"(前进一步)。他还得到了一个用于控制这个机器人的指令序列,他计划恰好修改k次这个指令序列(一次只能修改其中一个指令,同一个指令也可以被反复修改)后让机器人去执行,并使这个机器人最终停下的位置离起点尽量远。他想知道这个机器人最终停下的位置离起点的最远距离,请你帮助他!Input本题有多组测试数据,输入的第一行是一个整数T代表着测试数据的数量,接下来是T组测试数据。对于每组测试数据:第1行 包含一个长度不超过100的仅由"T&qu 阅读全文
posted @ 2012-04-18 01:02 'wind 阅读(349) 评论(0) 推荐(0) 编辑
摘要: Description设有N*N的方格图(N<=10),我们将其中的某些方格中填入正整数,而其他的方格中则放人数字0。如下图所示(见样例 ,黄色和蓝色分别为两次走的路线,其中绿色的格子为黄色和蓝色共同走过的):A1367142141514B某人从图的左上角的A点出发,可以向下行走,也可以向右走,直到到达右下角的B 点。在走过的路上,他可以取走方格中的数(取走后的方格中将变为数字0)。此人从A点到B点共走两次,试找出2条这样的路径,使得取得的数之和为最大。Input有多组测试数据,每组格式如下: 第一行为一个整数N(表示N*N的方格图),接下来的每行有三个整数,前两个表示位置,第三个数为该 阅读全文
posted @ 2012-04-16 18:55 'wind 阅读(317) 评论(0) 推荐(0) 编辑
摘要: DescriptionLeyni经过了若干年的征战,终于建立了自己的国家,这个国家包含n个城市,编号为1到n,而且这些城市之间存在m条双向通行的道路。不过Leyni的国家刚刚建立,所以他对每一条道路定义了道路警戒级别,由高到低分别为,a级,b级,c级。接下来,每条路径的路径警戒级别就等于这条路径所经过的所有道路的最高警戒级别;每两个城市之间的城际警戒级别就等于这两个城市之间的所有路径中的最低路径警戒级别。现在,Leyni告诉了你所有道路的道路警戒级别,他想知道某些城市之间的城际警戒级别,请你帮助他!Input本题有多组测试数据,输入的第一行是一个整数T代表着测试数据的数量,接下来是T组测试数据 阅读全文
posted @ 2012-04-15 21:20 'wind 阅读(267) 评论(0) 推荐(0) 编辑
摘要: Description给定一个有权图的每两个节点间的最短路径长度,判断能否找到原图。Input输入包括多组测试,每组测试的第一行为一个整数N,N<=100,表示图中有N个节点,然后是N行,每行有N个整数,第i行的第j个整数k表示从i节点到j节点的最短路径距离为k,k<1000000.Output对于每组测试数据,如果能够找到原图,则输出构成原图所需要的最少边数,否则输出“impossible“。Sample Input30 1 11 0 11 1 030 1 34 0 27 3 030 1 41 0 24 2 0Sample Output64impossibleView Code 阅读全文
posted @ 2012-04-15 19:27 'wind 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Description教授Leyni喜欢跟罗莉一起玩,这次,XianGe也来了,他们处在一个r*c的矩形区域中。Leyni处在矩形区域的入口外(左上角左侧),XianGe处在矩形区域的出口外(右下角右侧),罗莉处在矩形区域内。现在Leyni要喊话给XianGe,可是声音在这个矩形区域内只能横向或者垂直传递,而且,如果某个罗莉听到了声音(听到声音的罗莉不会阻碍声音继续传播),Leyni可以命令她作为传递者向四周传递一次声音,使得与她同一行同一列的罗莉都能听到声音(如下图右侧情况);当然,Leyni也可以让听到声音的罗莉不传递(如下图左侧情况);Leyni处在入口(左上角)的左侧,所以他只能向第一 阅读全文
posted @ 2012-04-15 13:51 'wind 阅读(404) 评论(0) 推荐(0) 编辑
摘要: DescriptionJimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To make things even nicer, his office is on one side of a forest, and his house is on the other. A nice walk through the forest, se 阅读全文
posted @ 2012-04-14 23:09 'wind 阅读(318) 评论(0) 推荐(0) 编辑
摘要: DescriptionSuppose there is a tree named A. All nodes of A have a weight v(0<v<4000000).Now, we will give the definition of "Prime Node".A node is a Prime Node if the following conditions are satisfied.The subtree of A whose root node is b will be marked as B. If all nodes in B have 阅读全文
posted @ 2012-04-13 00:06 'wind 阅读(335) 评论(0) 推荐(0) 编辑
摘要: DescriptionUnit Fraction is a special fraction.For example,1/2 , 1/3 and so on are Unit Fractions, as their numerator is 1 and denominator is the positive integer greater than 1.The ancient Greeks worship this type fraction.They think that everything in the world can be measured by the Unit Fraction 阅读全文
posted @ 2012-04-12 14:11 'wind 阅读(358) 评论(0) 推荐(0) 编辑
摘要: Problem descriptionThe best friends Mr. Li and Mr. Liu are touring in beautiful country M.M has n cities and m two-way roads in total. Each road connects two cities with fixed length.We assume that the cost of car traveling on the road is only related to the length of road,the longer road the more m 阅读全文
posted @ 2012-04-12 14:08 'wind 阅读(241) 评论(0) 推荐(0) 编辑
摘要: DescriptionBoss xnby owns a company, as you know, in the company there are lots of jobs to do.Each job J has a processing requirementpj(denoting the number of machine days required to complete the job), a release date rj(representing the beginning of the day when job j becomes avalible for processin 阅读全文
posted @ 2012-04-11 20:44 'wind 阅读(2749) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionNetwork flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted directed graph.InputThe first line of input contains an integer T, denoting the number of test cases.For each test case, the first line contains two 阅读全文
posted @ 2012-04-11 19:03 'wind 阅读(343) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionIn 2100, since the sea level rise, most of the cities disappear. Though some survived cities are still connected with others, but most of them become disconnected. The government wants to build some roads to connect all of these cities again, but they don’t want to take too much m 阅读全文
posted @ 2012-04-11 00:09 'wind 阅读(206) 评论(0) 推荐(0) 编辑
摘要: POJ推荐50题1. 标记 难 和 稍难 的题目大家可以看看,思考一下,不做要求,当然有能力的同学可以直接切掉。2. 标记为 A and B 的题目是比较相似的题目,建议大家两个一起做,可以对比总结,且二者算作一个题目。3. 列表中大约有70个题目。大家选做其中的50道,且每类题目有最低数量限制。4. 这里不少题目在 BUPT ACM FTP 上面都有代码,请大家合理利用资源。5. 50个题目要求每个题目都要写总结,养成良好的习惯。6. 这50道题的规定是我们的建议,如果大家有自己的想法请与我们 Email 联系。7. 建议使用 C++ 的同学在 POJ 上用 G++ 提交。8. 形成自己编写 阅读全文
posted @ 2012-04-10 22:36 'wind 阅读(213) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThe Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so the large road network is too expensive to maintain. The Council of Elders must 阅读全文
posted @ 2012-04-10 21:15 'wind 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Input输入数据首先包含一个正整数N,表示测试实例的个数,然后是N行数据,每行包括三个正整数A,B,C。Output对每个测试实例请输出计算后的结果,每个实例的输出占一行。Sample Input3 2 3 4 3 3 5 4 4 6Sample Output0 2 4code:View Code #include<stdio.h>int mod;int fu(long long a,long long b){ long long ans=1,m=a; while(b) { if(b&1) ans=(ans*m)%mod; ... 阅读全文
posted @ 2012-04-10 20:13 'wind 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个路口,标号为1的路口是商店所在地,标号为N的路口是赛场所在地,M则表示在成都有几条路。N=M=0表示输入结束。接下来M行,每行包括3个整数A,B,C(1<=A,B<=N,1<=C<=1000),表示在 阅读全文
posted @ 2012-04-10 19:41 'wind 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 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 message 阅读全文
posted @ 2012-04-10 18:52 'wind 阅读(307) 评论(0) 推荐(0) 编辑
摘要: DescriptionCc is a lovely monkey. It likes to play the game "catching plates".The game is as follows.There are n pegs in a line numbered from 1 to n. Cc stands on the first peg at the beginning. It is rather hard for Cc to jump from peg i to peg i+1(i+1<=n) or peg i-1(i-1>=1), which 阅读全文
posted @ 2012-04-08 21:55 'wind 阅读(371) 评论(0) 推荐(0) 编辑
摘要: Description俗话说“月有阴晴圆缺,人有悲欢离合。”。虽然大家都没这么悲催,但是心情的波动在所难免。MM的心情也会有波动,心情好心情值就高,心情不好心情值就低,每个小时都不一样,GG想知道MM最长的上升心情值的子序列,这样GG才好。。。按时间先后给出n个小时的心情值e[i],GG要求一个最长的子序列,使得该子序列e1< e2<e3<e4..<ek,并且使得e1+e2+e3+..+ek的和最大。Input有多组数据,对于每组数据,第一行是一个整数n(<=1000),接下来有n个整数ei。Output每组数据输出一行,该行包含两个数,表示最长子序列的长度和子序 阅读全文
posted @ 2012-04-07 22:58 'wind 阅读(264) 评论(0) 推荐(0) 编辑
摘要: Problem Description假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值<=50的单词呢?单词的价值就是组成一个单词的所有字母的价值之和,比如,单词ACM的价值是1+3+14=18,单词HDU的价值是8+4+21=33。(组成的单词与排列顺序无关,比如ACM与CMA认为是同一个单词)。Input输入首先是一个整数N,代表测试实例的个数。然后包括N行数据,每行包括26个<=20的整数x1,x2,.....x26.Output对于每个测试实例, 阅读全文
posted @ 2012-04-06 17:04 'wind 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Problem Description2007年到来了。经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列(f[0]=0,f[1]=1;f[i] = f[i-1]+f[i-2](i>=2))的值全部给背了下来。接下来,CodeStar决定要考考他,于是每问他一个数字,他就要把答案说出来,不过有的数字太长了。所以规定超过4位的只要说出前4位就可以了,可是CodeStar自己又记不住。于是他决定编写一个程序来测验zouyu说的是否正确。Input输入若干数字n(0 <= n <= 100000000),每个数字一行。读到文件尾。Out 阅读全文
posted @ 2012-04-06 17:03 'wind 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Problem Description妈妈你别哭泪光照亮不了我们的路让我们自己慢慢的走妈妈我会记住你和爸爸的模样记住我们的约定来生一起走上面这首诗节选自一位诗人纪念遇难同胞的作品,并没有华丽的语言,但是每位读者都应该能感受到作品传达的浓浓爱意,也许还有丝丝无奈。确实,太多的关于孩子不幸的报道冲击着我们每一颗柔弱的心。正如***总理所说“多难兴邦”,这场灾难让我们很多80后的年轻人一下子成熟了起来,其中很多人以自愿者的身份走上了抗震救灾的第一线。今天,灾区又来了n位志愿者,抗震救灾指挥部需要将他们分为若干个小组,小组的数量不限,但是要求每个小组的人数必须为素数,请问我们有几种分组的方法呢?特别说 阅读全文
posted @ 2012-04-06 17:02 'wind 阅读(260) 评论(0) 推荐(0) 编辑
摘要: Description将整数n分成k份,且每份不能为空,任意两份不能相同(不考虑顺序)。例如:n=7,k=3,下面三种分法被认为是相同的。1,1,5; 1,5,1; 5,1,1;问有多少种不同的分法。Input有多则测试数据。对于每组测试数据,仅有一行,包括两个整数n,k (6<n<=200,2<=k<=6)。Output对于每组测试数据,输出一个整数,即不同的分法。Sample Input7 3Sample Output4Hint输入: 7 3输出:4 {四种分法为:1,1,5; 1,2,4; 1,3,3; 2,2,3;}分析:此题和母函数①的不同之处在于划分数目是固 阅读全文
posted @ 2012-04-06 17:01 'wind 阅读(212) 评论(0) 推荐(0) 编辑
摘要: Problem Description开学了,杭电又迎来了好多新生。ACMer想为新生准备一个节目。来报名要表演节目的人很多,多达N个,但是只需要从这N个人中选M个就够了,一共有多少种选择方法?Input数据的第一行包括一个正整数T,接下来有T组数据,每组数据占一行。每组数据包含两个整数N(来报名的人数,1<=N<=30),M(节目需要的人数0<=M<=30)Output每组数据输出一个整数,每个输出占一行Sample Input53 25 34 43 68 0Sample Output310101方法一: 为防止溢出,可以采用乘一个除一个的方法。View Code # 阅读全文
posted @ 2012-04-06 16:58 'wind 阅读(215) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionTo improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortunately, he is unaware that the cows interpret some serial numbers as better than others. In particular, a cow whose s 阅读全文
posted @ 2012-04-06 16:57 'wind 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionIn many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you have to determine the number of digits in the factorial of the number.InputInput c 阅读全文
posted @ 2012-04-06 16:56 'wind 阅读(200) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 17 下一页