2013年4月26日
摘要: 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-04-26 19:24 耶稣爱你 阅读(182) 评论(0) 推荐(0)
摘要: Problem DescriptionThese days, you can do all sorts of things online. For example, you can use various websites to make virtual friends. For some people, growing their social network (their friends, their friends' friends, their friends' friends' friends, and so on), has become an addict 阅读全文
posted @ 2013-04-26 18:34 耶稣爱你 阅读(208) 评论(0) 推荐(0)
摘要: Problem DescriptionOnce in a forest, there lived N aggressive monkeys. At the beginning, they each does things in its own way and none of them knows each other. But monkeys can't avoid quarrelling, and it only happens between two monkeys who does not know each other. And when it happens, both th 阅读全文
posted @ 2013-04-26 13:15 耶稣爱你 阅读(226) 评论(0) 推荐(0)
  2013年4月25日
摘要: Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应M条道路,每行给出一对正整数,分别是该条道路直接连通的两个城镇的编号。为简单起见,城镇从1到N编号。 注意:两个城市之间可以有多条道路相通,也就是说 3 3 1 2 1 2 2 1 这种输入 阅读全文
posted @ 2013-04-25 13:37 耶稣爱你 阅读(115) 评论(0) 推荐(0)
  2013年4月21日
摘要: DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the phone catalogue listed these numbers:Emergency 911Alice 97 625 999Bob 91 12 54 26In this case, it's not possible to call Bob, because the central would 阅读全文
posted @ 2013-04-21 20:08 耶稣爱你 阅读(191) 评论(0) 推荐(0)
  2013年4月20日
摘要: Problem DescriptionXiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao what the kth great number is. Because the number written by Xiao Ming is too much, Xiao Bao is feeling giddy. Now, try to help Xiao Bao.InputThere are 阅读全文
posted @ 2013-04-20 21:01 耶稣爱你 阅读(222) 评论(0) 推荐(0)
摘要: Problem Description就要复试了,外地的考生都要在学校附近住宾馆了。假设在学校附近有C家宾馆,并且这些宾馆只有单人房,而每家宾馆的价格不一样,学生们都想找价格便宜的住,所以现在需要你的帮助,当有学生需要住宾馆的时候,告诉他哪个宾馆还有空的房间并且价格最便宜。而且有一个要求,同一个组的学生要住在同一个宾馆。Input输入包括多组数据。输入首先包括一个整数T(T <= 50),代表有T组数据。 每组数据首先是一个整数C(C <= 100),代表宾馆的个数,接下来是C行数据,每行3个整数,第一个代表宾馆的编号(<=1000),第二个是宾馆的房间数(<=50), 阅读全文
posted @ 2013-04-20 19:56 耶稣爱你 阅读(127) 评论(0) 推荐(0)
摘要: 描述现在有很多长方形,每一个长方形都有一个编号,这个编号可以重复;还知道这个长方形的宽和长,编号、长、宽都是整数;现在要求按照一下方式排序(默认排序规则都是从小到大);1.按照编号从小到大排序2.对于编号相等的长方形,按照长方形的长排序;3.如果编号和长都相同,按照长方形的宽排序;4.如果编号、长、宽都相同,就只保留一个长方形用于排序,删除多余的长方形;最后排好序按照指定格式显示所有的长方形;输入第一行有一个整数 0<n<10000,表示接下来有n组测试数据;每一组第一行有一个整数 0<m<1000,表示有m个长方形;接下来的m行,每一行有三个数 ,第一个数表示长方形的 阅读全文
posted @ 2013-04-20 16:21 耶稣爱你 阅读(166) 评论(0) 推荐(0)
摘要: 描述现在,有一行括号序列,请你检查这行括号是否配对。输入第一行输入一个数N(0<N<=100),表示有N组测试数据。后面的N行输入多组输入数据,每组输入数据都是一个字符串S(S的长度小于10000,且S不是空串),测试数据组数少于5组。数据保证S中只含有"[","]","(",")"四种字符输出每组输入数据的输出占一行,如果该字符串中所含的括号是配对的,则输出Yes,如果不配对则输出No#include<iostream>#include<stack>#include<st 阅读全文
posted @ 2013-04-20 15:55 耶稣爱你 阅读(137) 评论(0) 推荐(0)
摘要: Problem Description看病要排队这个是地球人都知道的常识。不过经过细心的0068的观察,他发现了医院里排队还是有讲究的。0068所去的医院有三个医生(汗,这么少)同时看病。而看病的人病情有轻重,所以不能根据简单的先来先服务的原则。所以医院对每种病情规定了10种不同的优先级。级别为10的优先权最高,级别为1的优先权最低。医生在看病时,则会在他的队伍里面选择一个优先权最高的人进行诊治。如果遇到两个优先权一样的病人的话,则选择最早来排队的病人。现在就请你帮助医院模拟这个看病过程。Input输入数据包含多组测试,请处理到文件结束。每组数据第一行有一个正整数N(0<N<200 阅读全文
posted @ 2013-04-20 15:30 耶稣爱你 阅读(173) 评论(0) 推荐(0)