21084_SignalStreng

2022-5-16 18:18| 发布者: Hocassian| 查看: 44| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504817738999-Problem List-采集的数据-后羿采集器.html

Pro.ID

21084

Title

Signal Strength

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21084

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Net Profits Incorporated has announced a new generation of network switching devices aimed at supporting high-speed, instantly reconfigurable networks over long distances.

    Their networks are based on a new kind of switching device that monitors several input lines, locking on to the strongest signal that it receives and passing that signal on to all output lines connected to its output ports.

    The connecting lines are long enough that signal loss is a major concern. The switches themselves may cause additional signal loss. To counter both sources of loss, some switches are equipped with amplifiers. (To prevent destructive feedback, switches with amplifiers will not be connected in cycles such that their output can reach their own inputs, even indirectly.)

    Develop a program to predict the effective signal strength that can be expected when a signal initiated at one point in a network is received at another point. You will be provided with a description of a network consisting ofNswitches (1 ≤ N ≤ 1000). For each switch, you will given a multiplier indicating how much weaker or stronger the output of the switch will be than the strength of the strongest input coming in to that switch. Switches without amplifiers will multiply the signal strength by a factor of no smaller than 0.1. Switches with amplifiers may multiply the signal strength by factors as high as 5.0.

    You will also be provided with a description of the connecting lines within the network, including a multiplier indicating how much weaker a signal is at the end of the line than when it entered. These multipliers will be no smaller than 0.1 and no larger than 1.0.

    输入

    Input consists of one or more input sets.

    Each input set describes one network. It begins with a line containing one integer, N, the number of switches in the network. These switches are identified by number starting at 0. The end of input is signaled by a non-positive value for N.

    This is followed by N lines, each describing one switch and the lines attached to the output of that switch. This description begins with a floating point number giving the strength multiplier for that switch. This is followed by an integer k indicating how many lines are connected to the output of the switch. After that are k pairs of numbers, each describing one output line. The first number in each pair gives the number of the switch to which this output line connects (i.e., the switch receiving this line as an input). The second number is a floating point number giving the multiplier describing the signal loss on that line.

    输出

    Description

    Net Profits Incorporated has announced a new generation of network switching devices aimed at supporting high-speed, instantly reconfigurable networks over long distances.

    Their networks are based on a new kind of switching device that monitors several input lines, locking on to the strongest signal that it receives and passing that signal on to all output lines connected to its output ports.

    The connecting lines are long enough that signal loss is a major concern. The switches themselves may cause additional signal loss. To counter both sources of loss, some switches are equipped with amplifiers. (To prevent destructive feedback, switches with amplifiers will not be connected in cycles such that their output can reach their own inputs, even indirectly.)

    Develop a program to predict the effective signal strength that can be expected when a signal initiated at one point in a network is received at another point. You will be provided with a description of a network consisting ofNswitches (1 ≤ N ≤ 1000). For each switch, you will given a multiplier indicating how much weaker or stronger the output of the switch will be than the strength of the strongest input coming in to that switch. Switches without amplifiers will multiply the signal strength by a factor of no smaller than 0.1. Switches with amplifiers may multiply the signal strength by factors as high as 5.0.

    You will also be provided with a description of the connecting lines within the network, including a multiplier indicating how much weaker a signal is at the end of the line than when it entered. These multipliers will be no smaller than 0.1 and no larger than 1.0.

    Input

    Input consists of one or more input sets.

    Each input set describes one network. It begins with a line containing one integer, N, the number of switches in the network. These switches are identified by number starting at 0. The end of input is signaled by a non-positive value for N.

    This is followed by N lines, each describing one switch and the lines attached to the output of that switch. This description begins with a floating point number giving the strength multiplier for that switch. This is followed by an integer k indicating how many lines are connected to the output of the switch. After that are k pairs of numbers, each describing one output line. The first number in each pair gives the number of the switch to which this output line connects (i.e., the switch receiving this line as an input). The second number is a floating point number giving the multiplier describing the signal loss on that line.

    Output

    For each network, print a line of the form

    Network M: X

    where M is the input set number (starting at 1) and where X is the signal strength expected at the output for switch N - 1 if an input signal of strength 1.0 is presented at (all) inputs of switch 0. If that input never appears at the output of switch N - 1, then X should be zero. X should be printed to two digits precision.

    Example:The networks shown here are described by the following input and output.

    Sample Input
    4
    1.0 2 1 0.75 2 0.98
    1.25 1 3 0.9
    0.75 1 3 0.5
    0.9 0
    6
    1.0 2 1 0.9 2 0.9
    0.95 2 2 0.7 3 0.6
    0.95 1 4 0.8
    1.0 1 4 0.4
    1.25 1 5 1.0
    1.1 0
    0
    Sample Output
    Network 1: 0.76 
    Network 2: 0.94
    Source

    样例输入

    4
    1.0 2 1 0.75 2 0.98
    1.25 1 3 0.9
    0.75 1 3 0.5
    0.9 0
    6
    1.0 2 1 0.9 2 0.9
    0.95 2 2 0.7 3 0.6
    0.95 1 4 0.8
    1.0 1 4 0.4
    1.25 1 5 1.0
    1.1 0
    0

    样例输出

    Network 1: 0.76 
    Network 2: 0.94

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部