本文介绍了如何在C编程中对此进行编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此问题中,您将获得一个网络.网络建立在通过双向导线连接的n台服务器上.两台服务器最多可以通过一根电线直接连接.每两台服务器通过网络中的某个路径连接.每条电线都有固定的正成本,与传输相关.两个服务器V和W之间的距离D(V,W)定义为网络中连接V和W的任何路径中的最小成本.传输到同一服务器的成本为0,即所有V的D(V,V)=0.传输的两侧成本都相同.一些服务器比其他服务器提供更多的服务.因此,每个服务器V都标记有编号r(V),称为等级.在每台服务器上,需要存储有关附近服务器的数据.但是,对于给定的服务器,并非所有服务器都感兴趣存储数据.不需要存储与低级别的远程服务器有关的数据.更具体地,服务器W对于服务器V是有趣的,如果对于每个服务器U使得D(V,U)= D(V,W),则满足以下条件:r(U)= r(W).令B(V)表示服务器V感兴趣的服务器集合.在此问题中,您需要计算所有集合B(V)的大小总和,这表示需要存储在服务器V中的总数据.

In this problem, you are given a network. Network is built upon n servers connected by bidirectional wires. Two servers can be directly connected by at most one wire. Every two servers are connected with some path in the network. Each wire has a fixed positive cost associated with the transmission. The distance D(V, W) between two servers V and W is defined as the smallest cost of any path connecting V and W in the network. The cost of transmission to the same server is 0 i.e. D(V, V) = 0 for all V. The cost is same on both sides of the transmission. Some servers offer more services than others. Therefore each server V is marked with a number r(V), called a rank. At each server, data about nearby servers needs to be stored. However, for a given server, not all servers are interesting to store data about. The data about distant servers with low ranks need not to be stored. More specifically, a server W is interesting for a server V, if for every server U such that D(V, U) = D(V, W), the following condition is satisfied: r(U) = r(W). Let B(V) denote the set of servers which are interesting for a server V. In this problem, you need to compute the total sum of sizes of all sets B(V), which represents the total data need to be stored in the network.

推荐答案


这篇关于如何在C编程中对此进行编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 06:34