Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A network setup company was contracted by an IT firm to establish servers and client machines in their new building. However, upon completion of the
A network setup company was contracted by an IT firm to establish servers and client machines in their new
building. However, upon completion of the network setup, significant connection issues were discovered,
requiring extensive time and effort to rectify.
The building's head office is a multilevel structure comprising levels, with offices on each level. A server
is installed on every level. As per the network design, connections to all offices on a level are operational only
when the respective server is online. Unfortunately, due to errors in the network setup, some offices have
incorrect connections. These offices are connected and functional only when the server is offline. It is
conceivable for a level to have both correctly and incorrectly connected offices.
Correcting all network connections would incur substantial expenses, which the IT company finds prohibitive.
Instead, they opt to optimize network connectivity by initially activating all servers and subsequently
deactivating precisely of them to maximize the total number of online offices in the building.
Write a program to help maximize the online offices!
Input Format
The first line reads integers and where is the number of levels in the building, is the number of
offices on each level, and is the number of servers which would be turned off. Each of the next input
lines, has an integer between and which gives the number of offices that are online on that level.
Constraints
Output Format
integer values giving the total number online offices.
Sample Input
Write on java
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started