
HYNU新生练习
文章平均质量分 73
Rechard_chen
不积跬步无以至千里。
展开
-
Fill
DescriptionThere are three jugs with a volume of a, b and c liters. (a, b, and c are positive integers not greater than 200). The first and the second jug are initially empty, while the third原创 2014-11-26 19:22:22 · 946 阅读 · 0 评论 -
Slim Span
DescriptionGiven an undirected weighted graph G , you should find one of spanning trees specified as follows. The graph G is an ordered pair(V, E) , where V is a set of vertices{v1, v2原创 2014-11-26 19:49:15 · 1027 阅读 · 0 评论 -
Segment
DescriptionGiven n segments in the two dimensional space, write a program, which determines if there exists a line such that after projecting these segments on it, all projected segments have at原创 2014-11-04 20:51:17 · 1018 阅读 · 0 评论 -
友好城市
Problem DescriptionPalmia国有一条横贯东西的大河,河有笔直的南北两岸,岸上各有位置各不相同的N个城市。北岸的每个城市有且仅有一个友好城市在南岸,而且不同城市的友好城市不相同。每对友好城市都向政府申请在河上开辟一条直线航道连接两个城市,但是由于河上雾太大,政府决定避免任意两条航道交叉,以避免事故。编程帮助政府做出一些批准和拒绝申请的决定,使得在保证任意两条航线不相原创 2014-10-16 21:15:31 · 883 阅读 · 0 评论 -
大魔术师
Problem DescriptionLittleMing 刚刚看了《大魔术师》这部电影,他对魔术产生了浓厚的兴趣。于是,他决定向大魔术师 BigMing学习魔术。今天, BigMing 要教给 LittleMing 的魔 术是这样的 :道 具是 13 张黑桃扑克A,2,3,4,5,6,7,8,9,10,J,Q,K。这 13 张牌预先排好,正面朝下,拿在魔术师的手里,从上面开始,第一次数一原创 2014-10-16 21:13:07 · 527 阅读 · 0 评论 -
挖地雷
Problem Description在一个地图上有n个地窖(nInput输入有多组数据,每组数据的第一行为一个整数n,表示地窖的个数,第二行为n个地窖中的地雷数。下面多行数据以0,0结束,每行为两个数x和y,表示从x可以到y。Output对于每组数据输出两行,第一行为挖地雷的顺序,第二行为最多挖出的地雷数Sample Input65 10原创 2014-10-16 21:13:45 · 897 阅读 · 0 评论 -
Ignatius and the Princess IV
Problem Description"OK, you are not too bad, em... But you can never pass the next test." feng5166 says."I will tell you an odd number N, and then N integers. There will be a special integer a原创 2014-10-31 11:50:26 · 518 阅读 · 0 评论 -
ZZ的橱柜
Problem DescriptionZZ不仅喜欢买衣服,还是个吃货,天哪!现在的妹纸是怎么了?╮(╯_╰)╭,ZZ有两个大型橱柜A和B,里面放满了零食,每个橱柜里面有N个方格,每个方格里面放了不同重量的美味,现在ZZ要从A、B里面各取一个方格的美味,可是ZZ不想变得太胖,于是他会尽量的选择重量少的美味,当然不是所有的组合都是ZZ喜欢吃的美味,所以她想了一个特别的方法,他会选出组合重量最小原创 2014-10-31 12:02:29 · 1222 阅读 · 0 评论 -
X-Plosives
Problem descriptionA secret service developed a new kind of explosive that attain its volatile property only when a speci cassociation of products occurs. Each product is a mix of two differen原创 2014-11-17 20:34:19 · 742 阅读 · 0 评论 -
剪花布条
Problem Description一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符原创 2014-10-27 23:56:52 · 699 阅读 · 0 评论 -
密码
Problem Description网上流传一句话:"常在网上飘啊,哪能不挨刀啊~"。其实要想能安安心心地上网其实也不难,学点安全知识就可以。首先,我们就要设置一个安全的密码。那什么样的密码才叫安全的呢?一般来说一个比较安全的密码至少应该满足下面两个条件:(1).密码长度大于等于8,且不要超过16。(2).密码中的字符应该来自下面“字符类别”中四组中的至少三组。原创 2014-10-27 13:31:14 · 695 阅读 · 0 评论 -
sliding window
DescriptionAn array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the wi原创 2014-10-24 20:29:58 · 652 阅读 · 0 评论 -
Stacks of Flapjacks
Stacks of FlapjacksBackgroundStacks and Queues are often considered the bread and butter of data structures and find use in architecture, parsing, operating systems, and discrete eve原创 2014-11-05 20:06:28 · 822 阅读 · 0 评论 -
A Spy in the Metro
DescriptionSecret agent Maria was sent to Algorithms City to carry out an especially dangerous mission. After several thrilling events we find her in the first station of Algorithms City Metro,原创 2014-11-21 20:30:24 · 1509 阅读 · 0 评论 -
Amphiphilic Carbon Molecules
Description:Shanghai Hypercomputers, the world's largest computer chip manufacturer, has invented a new class of nanoparticles called Amphiphilic Carbon Molecules (ACMs). ACMs are semiconductors原创 2014-12-12 20:31:29 · 1043 阅读 · 0 评论 -
Calling Circles
Description:If you've seen television commercials for long-distance phone companies lately, you've noticed that many companies have been spending a lot of money trying to convince people that th原创 2014-12-12 21:11:12 · 763 阅读 · 0 评论 -
Quadtrees
Description:A quadtree is a representation format used to encode images. The fundamental idea behind the quadtree is that any image can be split into four quadrants. Each quadrant may again原创 2014-12-08 20:04:15 · 621 阅读 · 0 评论 -
Solve equation
DescriptionYou are given two positive integers A and B in Base C. For the equation:A=k*B+d We know there always existing many non-negative pairs (k, d) that satisfy the equation above. Now原创 2014-12-16 19:46:07 · 671 阅读 · 0 评论 -
Star
DescriptionOverpower often go to the playground with classmates. They play and chat on the playground. One day, there are a lot of stars in the sky. Suddenly, one of Overpower’s classmates ask him:原创 2014-12-16 19:52:34 · 828 阅读 · 0 评论 -
Brackets sequence
Description:Let us define a regular brackets sequence in the following way:1.Empty sequence is a regular sequence.2.If S is a regular sequence, then (S) and [S] are both regular sequences.3.If原创 2014-12-01 21:40:41 · 842 阅读 · 0 评论 -
Swap Digits
DescriptionNow we have a number, you can swap any two adjacent digits of it, but you can not swap more than K times. Then, what is the largest probable number that we can get after you原创 2014-11-24 23:26:13 · 660 阅读 · 0 评论 -
计算
Problem Description小明在你的帮助下,破译了Ferrari设的密码门,正要往前走,突然又出现了一个密码门,门上有一个算式,其中只有“(”、“)”、“0-9”、“+”、“-”、“*”、“/”、“^”,求出的值就是密码。小明的数学学得不好,还需你帮他的忙。(“/”用整数除法)Input输入的第一行为T,表示测试示例的个数,每组数据只有一行是一个算式(算式长度原创 2014-10-21 20:11:48 · 590 阅读 · 0 评论 -
大魔术师
Problem DescriptionLittleMing 刚刚看了《大魔术师》这部电影,他对魔术产生了浓厚的兴趣。于是,他决定向大魔术师 BigMing学习魔术。今天, BigMing 要教给 LittleMing 的魔 术是这样的 :道 具是 13 张黑桃扑克A,2,3,4,5,6,7,8,9,10,J,Q,K。这 13 张牌预先排好,正面朝下,拿在魔术师的手里,从上面开始,第一次数一原创 2014-10-21 20:12:28 · 606 阅读 · 0 评论 -
Send a Table
When participating in programming contests, you sometimes face the following problem: You know how to calcutale the output for the given input values, but your algorithm is way too slow to ever pass t原创 2014-11-21 21:02:45 · 563 阅读 · 0 评论 -
一行盒子
Description你有一行盒子,从左到右依次编号为1, 2, 3,…, n。你可以执行四种指令:1 X Y表示把盒子X移动到盒子Y左边(如果X已经在Y的左边则忽略此指令)。2 X Y表示把盒子X移动到盒子Y右边(如果X已经在Y的右边则忽略此指令)。3 X Y表示交换盒子X和Y的位置。4 表示反转整条链。指令保证合法,即X不等于Y。例如,当n=6时在初始状态下原创 2014-10-24 19:59:52 · 996 阅读 · 1 评论 -
Trees on the level
BackgroundTrees are fundamental in many branches of computer science. Current state-of-the art parallel computers such as Thinking Machines' CM-5 are based onfat trees. Quad- and octal-trees are f原创 2014-11-11 19:51:48 · 842 阅读 · 0 评论 -
Tree
You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf. The value of a path is the sum o原创 2014-11-11 19:38:13 · 643 阅读 · 0 评论 -
病毒
Problem Description你有一个日志文件,里面记录着各种系统事件的详细信息。自然的,事件的时间戳按照严格递增顺序排列(不会有两个事件在完全相同的时刻发生)。遗憾的是,你的系统被病毒感染了,日志文件中混入了病毒生成的随机伪事件(但真实事件的相对顺序保持不变)。备份的日志文件也被感染了,但由于病毒采用的随机感染方法,主日志文件和备份日志文件在感染后可能会变得不一样。给出被感染原创 2014-08-27 15:51:43 · 544 阅读 · 0 评论 -
奖学金
Problem Description某小学最近得到了一笔赞助,打算拿出其中一部分为学习成绩优秀的前5名学生发奖学金。期末,每个学生都有3门课的成绩:语文、数学、英语。先按总分从高到低排序,如果两个同学总分相同,再按语文成绩从高到低排序,如果两个同学总分和语文成绩都相同,那么规定学号小的同学排在前面,这样,每个学生的排序是唯一确定的。任务:先根据输入的3门课的成绩计算总分,然后按上述规则排原创 2014-08-27 14:47:10 · 1997 阅读 · 0 评论 -
单词缩写
Problem Description我们经常用一串短的字母代替一些长的单词。如ACM是Association for Computing Machinery的缩写。现在你用取首字母的办法得到一串单词的缩写。取首字母的办法是指把每个单词的首字母取出来用大写字母表示,然后把这些大写字母拼起来。但是也有些情况是例外的:一些情况在产生缩写是会被忽略,这些特殊情况见下面的规则:1.常用的单词:an原创 2014-08-27 14:43:02 · 885 阅读 · 0 评论 -
装载问题
Problem Description在一批共n个集装箱要装上艘载重量为c的轮船,其中集装箱i的重量为wi。找出一种最优装载方案,将轮船尽可能装满,即在装载体积不受限制的情况下,将尽可能重的集装箱装上轮船。Input输入有多组数据,每组数据的第一行有两个正整数n和c。n是集装箱数,c是轮船的载重量。接下来的1行中有n个正整数,表示集装箱的重量。Output对于每组数据输原创 2014-09-02 16:13:54 · 657 阅读 · 0 评论 -
WXYZ与绿豆饼
Problem DescriptionWXYZ很喜欢吃绿豆饼,而且每次都能吃很多。但是担心WXYZ长的太胖,妈妈把买回来的一卷卷的绿豆饼排成一列(每卷绿豆饼的高度可能是不一样的),规定WXYZ只能取其中一段连续的并且高度严格上升的绿豆饼来吃。可怜的WXYZ发现,根据这个规则,每次他只能拿到很少的绿豆饼,于是他想到了一个办法:趁妈妈不注意的时候改变某一卷绿豆饼的高度(压扁或拉长它)。WXYZ原创 2014-09-09 13:31:22 · 676 阅读 · 0 评论 -
Nightmare
Problem DescriptionIgnatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb原创 2014-08-21 10:57:01 · 555 阅读 · 0 评论 -
表达式求值(栈的运用)
Problem DescriptionDr.Kong设计的机器人卡多掌握了加减法运算以后,最近又学会了一些简单的函数求值,比如,它知道函数min(20,23)的值是20 ,add(10,98) 的值是108等等。经过训练,Dr.Kong设计的机器人卡多甚至会计算一种嵌套的更复杂的表达式。假设表达式可以简单定义为:1. 一个正的十进制数 x 是一个表达式。2. 如果 x 和 y原创 2014-08-07 21:13:24 · 722 阅读 · 0 评论 -
一元三次方程
Problem Description有形如:ax^3+bx^2+cx+d=0这样的一个一元三次方程。给出该方程中各项的系数(a,b,c,d均为实数),并约定该方程存在三个不同实根(根的范围在-100至100之间),且根与根之差的绝对值>=1。要求由小到大依次在同一行输出这三个实根(根与根之间留有空格),并精确到小数点后2位。 提示:记方程f(x)=0,若存在2个数x1和x2,且x原创 2014-07-24 11:34:58 · 777 阅读 · 0 评论 -
螺旋方阵
Problem DescriptionGiven an odd number n, we can arrange integers from 1 to n*n in the shape of a spiral. The figure below illustrates the spiral made by integers from 1 to 25.1 2 3 4 5 --原创 2014-08-07 09:10:40 · 961 阅读 · 0 评论 -
cover
Problem DescriptionTom wants to cover a rectangular floor by identical L-shape tiles without overlap. As shown below, the floor can be split into many small squares, and the L-shape tile consists原创 2014-07-30 09:46:00 · 529 阅读 · 0 评论 -
Single Round Match
Problem DescriptionAssociation for Couples Match (ACM) is a non-profit organization which is engaged in helping single people to find his/her other half. As November 11th is "Singles Day", on this原创 2014-07-28 11:37:29 · 483 阅读 · 0 评论 -
单词选择
Problem Description我们都知道,学习英语单词最好的方法就是在相应的句子和语言环境中学习。小W最近定下来一个学习单词的计划,他要背n个单词,但他想通过背一篇文章的一段来记住这些单词。假定现在小W手中有一篇包含m个单词的文章,他想在文章中找出连续的一段,其中包含最多的他所要背的单词(重复的只算一个),并且使这段连续的单词长度最短。这样他就可以用尽量短的时间学习尽可能多的单词了原创 2014-08-27 21:26:14 · 501 阅读 · 0 评论 -
庆功会
Problem Description为了庆贺班级在校运动会上取得全校第一名成绩,班主任决定开一场庆功会,为此拨款购买奖品犒劳运动员。期望拨款金额能购买最大价值的奖品,可以补充他们的精力和体力。Input输入第一行为T,表示数据组数,对于每组数据的第一行二个数n(n接下来n行,每行3个数,v、w、s,分别表示第I种奖品的价格、价值(价格与价值是不同的概念)和购买的数量(原创 2014-08-15 20:24:18 · 1632 阅读 · 0 评论