We all know about the recent flood in Sylhet. Every area of Sylhet can be expressed with a number. If there are n number of areas in Sylhet then they can be expressed as 1, 2, 3...n-1n. Where the in area is located after the (-1) area. Volume of each area of Sylhet is 1 meter. A few dams have been constructed in certain areas in Sylhet. Each dam is pre-planned to be built at a certain height so that the flood water cannot completely inundate the city. Flood water will enter through the 1 area. The height of the dam in the area is B, meter. If the water level in area i is greater than B meter then the remaining water will flow in (i+1), area. Due to the good communication system of Sylhet people can move from one area to another before any danger. Sylhet is the city of rain. Every area has some tall buildings built to deal with the flood problem. The building in the fe area has H, floors and each floor has a height of Imeter. Due to the weather forecast people can know how much water will flow in Sylhet city. One floor can accommodate I person. But when a floor goes under water, that floor becomes uninhabitable. So there will be a housing crisis for many people. So the local authority decided to build extra floors in some buildings. You have to print the minimum number of floors to build so that all people can stay safe. if the water level exceeds the height of the dam in n area, the excess water will spill into the sea. if an area is not inundated, everyone will take shelter in buildings due to the advance forecast of floods. Input The first line will contain n. Number of areas in Sylhett1

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Limits 15, 128 MB
We all know about the recent flood in Sylhet. Every area of Sylhet can be expressed with a number. If there are n number of areas in Sylhet then they can be expressed as 1, 2, 3...n-1,n. Where the
area is located after the (1) area. Volume of each area of Sylhet is 1 meter. A few dams have been constructed in certain areas in Sylhet. Each dam is pre-planned to be built at a certain height so
that the flood water cannot completely inundate the city Flood water will enter through the 1, area. The height of the dam in the area is B, meter. If the water level in area i is greater than B
meter then the remaining water will flow in (i+1), area. Due to the good communication system of Sylhet, people can move from one area to another before any danger
Sylhet is the city of rain. Every area has some tall buildings built to deal with the flood problem. The building in the fen area has H, floors and each floor has a height of 1meter. Due to the weather
forecast people can know how much water will flow in Sylhet city. One floor can accommodate I person. But when a floor goes under water, that floor becomes uninhabitable. So there will be a housing
crisis for many people. So the local authority decided to build extra floors in some buildings. You have to print the minimum number of floors to build so that all people can stay safe
If the water level exceeds the height of the dam in n area, the excess water will spill into the sea.
if an area is not inundated, everyone will take shelter in buildings due to the advance forecast of floods.
Input
The first line will contain n. Number of areas in Sylhett1 <n<10).
The second line will contain a numbers, where a, is the number of people in the ich area(0<a, ≤ 10%).
The third line will contain a numbers, Where B, denotes the height of the dam in the feh area(1B S 10%).
The fourth line will contain n numbers, where H, denotes the height of the building in the areal1<H₁ <B₂).
The next line will contain q. Number of queries(1 <q <10%)
Each line of the next g line will have a number V. According to the weather forecast, how much water can enter in the city(1<V ≤ 10%),
Output
Print the minimum number of floors to be constructed.
Samples
Input
3
hard..
10 10 10
5:10 5
465
16
Input
10 10 10
5 10 5
485
11
O
Output
18
24
25
Output
13
23
Transcribed Image Text:Limits 15, 128 MB We all know about the recent flood in Sylhet. Every area of Sylhet can be expressed with a number. If there are n number of areas in Sylhet then they can be expressed as 1, 2, 3...n-1,n. Where the area is located after the (1) area. Volume of each area of Sylhet is 1 meter. A few dams have been constructed in certain areas in Sylhet. Each dam is pre-planned to be built at a certain height so that the flood water cannot completely inundate the city Flood water will enter through the 1, area. The height of the dam in the area is B, meter. If the water level in area i is greater than B meter then the remaining water will flow in (i+1), area. Due to the good communication system of Sylhet, people can move from one area to another before any danger Sylhet is the city of rain. Every area has some tall buildings built to deal with the flood problem. The building in the fen area has H, floors and each floor has a height of 1meter. Due to the weather forecast people can know how much water will flow in Sylhet city. One floor can accommodate I person. But when a floor goes under water, that floor becomes uninhabitable. So there will be a housing crisis for many people. So the local authority decided to build extra floors in some buildings. You have to print the minimum number of floors to build so that all people can stay safe If the water level exceeds the height of the dam in n area, the excess water will spill into the sea. if an area is not inundated, everyone will take shelter in buildings due to the advance forecast of floods. Input The first line will contain n. Number of areas in Sylhett1 <n<10). The second line will contain a numbers, where a, is the number of people in the ich area(0<a, ≤ 10%). The third line will contain a numbers, Where B, denotes the height of the dam in the feh area(1B S 10%). The fourth line will contain n numbers, where H, denotes the height of the building in the areal1<H₁ <B₂). The next line will contain q. Number of queries(1 <q <10%) Each line of the next g line will have a number V. According to the weather forecast, how much water can enter in the city(1<V ≤ 10%), Output Print the minimum number of floors to be constructed. Samples Input 3 hard.. 10 10 10 5:10 5 465 16 Input 10 10 10 5 10 5 485 11 O Output 18 24 25 Output 13 23
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Knapsack Problem
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education