Computer Science, asked by ramramudu51, 4 months ago

The computer systems of N employees of a company are arranged in a row. A technical fault in the power supply has caused some of the systems to turn OFF while the others remain ON. Because of this, the employees whose systems are OFF are unable to work. The company does not like to see its employees sitting idle. So bh til the technical team can find the actual cause of the breakdown, the technical head Adam has devised a temporary workaround for the OFF systems at a minimum cost. Adam decides to connect all the OFF systems to the nearest ON system with the shortest possible length of cable. To make this happen, he calculates the distance of each system from the first system

Write an algorithm to help Adam find the minimum length of cable he needs to turn all the systems ON​

Answers

Answered by kpkr886
3

Explanation:

the Bill amounts that are perfect squares are 25 and 81

so. that output is2

Answered by shanthinigv
10

Answer:

Input:

The first line of the input consists of an integral num,  representing the number of system (N)=3

The second line consists of N space-separated integers representing the initial state of each systems ,ON(1) or OFF(0)=100

The last line consists of N space-separated integers representing the distance of the systems from the first systems=156

Output:

Print an integer representing the minimum length of the cable used to turn all the systems ON=5.

Explanation:

Length of the cable required to connect the 2nd system to the 1st system =4

Length of the cable required to connect the 3rd system to the 2nd system=1

The total length of the cable = 5(4+1)

So, the output is 5.

Similar questions