Skip to content

Commit 14168d3

Browse files
authored
Create electronics-shop.py
1 parent 0c55b66 commit 14168d3

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

electronics-shop.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# https://www.hackerrank.com/challenges/electronics-shop/problem
2+
3+
#!/bin/python3
4+
5+
import sys
6+
7+
8+
s,n,m = input().strip().split(' ')
9+
s,n,m = [int(s),int(n),int(m)]
10+
keyboards = [int(keyboards_temp) for keyboards_temp in input().strip().split(' ')]
11+
pendrives = [int(pendrives_temp) for pendrives_temp in input().strip().split(' ')]
12+
13+
max_price = -1
14+
for i in range(0,len(keyboards)):
15+
for j in range(0,len(pendrives)):
16+
if keyboards[i]+pendrives[j] == s:
17+
max_price = s
18+
break
19+
elif ((keyboards[i]+pendrives[j]) < s) and ((keyboards[i]+pendrives[j]) > max_price):
20+
max_price = keyboards[i]+pendrives[j]
21+
if max_price == s:
22+
break
23+
print(max_price)

0 commit comments

Comments
 (0)