英语翻译DescriptionStockbrokers are known to overreact to rumours.You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the stock market.For maximum effect,you have to spread the rumours in the fastest possible way.Unfortunately for you,stockbrokers only trust information ing from their Trusted sources This means you have to take into account the structure of their contacts when starting a rumour.It takes a certain amount of time for a specific stockbroker to pass the rumour on to each of his colleagues.Your task will be to write a program that tells you which stockbroker to choose as your starting point for the rumour,as well as the time it will take for the rumour to spread throughout the stockbroker munity.This duration is measured as the time needed for the last person to receive the information.InputYour program will input data for different sets of stockbrokers.Each set starts with a line with the number of stockbrokers.Following this is a line for each stockbroker which contains the number of people who they have contact with,who these people are,and the time taken for them to pass the message to each person.The format of each stockbroker line is as follows:The line starts with the number of contacts (n),followed by n pairs of integers,one pair for each contact.Each pair lists first a number referring to the contact (e.g.a '1' means person number one in the set),followed by the time in minutes taken to pass a message to that person.There are no special punctuation symbols or spacing rules.Each person is numbered 1 through to the number of stockbrokers.The time taken to pass the message on will be between 1 and 10 minutes (inclusive),and the number of contacts will range between 0 and one less than the number of stockbrokers.The number of stockbrokers will range from 1 to 100.The input is terminated by a set of stockbrokers containing 0 (zero) people.OutputFor each set of data,your program must output a single line containing the person who results in the fastest message transmission,and how long before the last person will receive any given message after you give it to this person,measured in integer minutes.It is possible that your program will receive a network of connections that excludes some persons,i.e.some people may be unreachable.If your program detects such a broken network,simply output the message disjoint.Note that the time taken to pass the message from person A to person B is not necessarily the same as the time taken to pass it from B to A,if such transmission is possible at all.注释:这是道编程
网友回答
【答案】 ……那就不按照原题的背景翻译了
抽象出来就是:
给定一个有向图,求一个点,使得其他各点到此点的最短路径长度最大值最小
/*
就是说每选一个点都可以求一遍单元最短路径,其中有一个离初始点最远的,设这个点距离为d
你得求出从那个点开始 能使d最小
*/
输入有多组数据
每组数据第一行为点的数目n
第二行开始的n行为描述边
其中的第i行先是一个整数num[i],表示点i连出多少条边
紧接着是2*num[i]个数,两两一组,表示连出边到哪,长度多少
输入数据以n=0结尾
输出格式
对于每组输入数据,先输出一个什么东西(没看懂)
再输出最远点距离的最小值
注意:
1、是有向图
2、需要判断是不是有点无法到达(没有边连到)
如果有的话输出disjoint
————————————————————
这题想一想……
朴素的话O(n^2logn)能过……!数据量太小了 n≤100……