-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodejam_blocks.py
More file actions
22 lines (18 loc) · 782 Bytes
/
codejam_blocks.py
File metadata and controls
22 lines (18 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Google Codejam Question
# Find the area of the largest rectangle formed by buliding blocks of some width and height.
# The blocks are placed next to each other such that there is no gap between any two consecutive blocks.
# Input : n - Number of blocks
# : w,h - width of block, height of block
# Outupt : o - area of largest rectangle formed by these blocks.
block_count = int(input('Enter the total count of blocks : '))
width=[]
height=[]
for i in range(0, block_count):
vara, varb = map(int, input("Enter width & height of block seperated by comma : ").split(','))
width += [vara]
height += [varb]
total_width=0
for i in width:
total_width=total_width+i
min_height = sorted(height)[0]
print('Total area of blocks is : ', (total_width*min_height), ' square units')