![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图
暖i
这个作者很懒,什么都没留下…
展开
-
1021 Deepest Root
A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root ...原创 2019-10-24 17:57:59 · 132 阅读 · 0 评论 -
1013 Battle Over Cities
It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we nee...原创 2019-10-24 16:19:14 · 103 阅读 · 0 评论 -
1034 Head of a Gang
One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be t...原创 2019-10-22 17:07:21 · 111 阅读 · 0 评论 -
1344:【例4-4】最小花费
【题目描述】在n个人中,某些人的银行账号之间可以互相转账。这些人之间转账的手续费各不相同。给定这些人之间转账时需要从转账金额里扣除百分之几的手续费,请问A最少需要多少钱使得转账后B收到100元。【输入】第一行输入两个正整数n,m,分别表示总人数和可以互相转账的人的对数。以下m行每行输入三个正整数x,y,z,表示标号为x的人和标号为y的人之间互相转账需要扣除z%的手续费 (z<100)...原创 2019-10-19 10:33:59 · 724 阅读 · 0 评论 -
1383:刻录光盘(cdrom)
【题目描述】在FJOI2010夏令营快要结束的时候,很多营员提出来要把整个夏令营期间的资料刻录成一张光盘给大家,以便大家回去后继续学习。组委会觉得这个主意不错!可是组委会一时没有足够的空光盘,没法保证每个人都能拿到刻录上资料的光盘,怎么办呢?!DYJ分析了一下所有营员的地域关系,发现有些营员是一个城市的,其实他们只需要一张就可以了,因为一个人拿到光盘后,其他人可以带着U盘之类的东西去拷贝啊!...原创 2019-10-18 20:56:08 · 364 阅读 · 0 评论 -
1087 All Roads Lead to Rome
Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happiness.Input Specification:Each in...原创 2019-10-14 20:11:10 · 98 阅读 · 0 评论 -
1072 Gas Station
A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must guarantee that all the hou...原创 2019-10-13 16:25:24 · 205 阅读 · 0 评论 -
1018 Public Bike Management
There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and return it to any other stations in the ...原创 2019-10-12 21:10:05 · 85 阅读 · 0 评论 -
1030 Travel Plan
A traveler’s map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path b...原创 2019-10-12 15:33:39 · 104 阅读 · 0 评论 -
1003 Emergency
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the l...原创 2019-10-12 12:54:52 · 94 阅读 · 0 评论 -
1343:【例4-2】牛的旅行
【题目描述】农民John的农场里有很多牧区。有的路径连接一些特定的牧区。一片所有连通的牧区称为一个牧场。但是就目前而言,你能看到至少有两个牧区不连通。现在,John想在农场里添加一条路径 ( 注意,恰好一条 )。对这条路径有这样的限制:一个牧场的直径就是牧场中最远的两个牧区的距离 ( 本题中所提到的所有距离指的都是最短的距离 )。考虑如下的两个牧场,图1是有5个牧区的牧场,牧区用“*”表示,路径...原创 2019-09-25 11:33:44 · 899 阅读 · 0 评论 -
1342:【例4-1】最短路径问题
【题目描述】平面上有n个点(n≤100),每个点的坐标均在-10000~10000之间。其中的一些点之间有连线。若有连线,则表示可从一个点到达另一个点,即两点间有通路,通路的距离为两点间的直线距离。现在的任务是找出从一点到另一点之间的最短路径。【输入】共n+m+3行,其中:第一行为整数n。第2行到第n+1行(共n行) ,每行两个整数x和y,描述了一个点的坐标。第n+2行为一个整数m,...原创 2019-09-22 10:51:04 · 905 阅读 · 0 评论 -
1341:【例题】一笔画问题
【题目描述】如果一个图存在一笔画,则一笔画的路径叫做欧拉路,如果最后又回到起点,那这个路径叫做欧拉回路。根据一笔画的两个定理,如果寻找欧拉回路,对任意一个点执行深度优先遍历;找欧拉路,则对一个奇点执行dfs,时间复杂度为O(m+n),m为边数,n是点数。【输入】第一行n,m,有n个点,m条边,以下m行描述每条边连接的两点。【输出】欧拉路或欧拉回路,输出一条路径即可。【输入样例】5 ...原创 2019-09-18 15:52:44 · 1198 阅读 · 1 评论