# My code
def getMoneySpent(keyboards, drives, b):
temp = -1
for keyboard in keyboards:
for drive in drives:
if keyboard + drive <= b:
if temp < keyboard + drive:
temp = keyboard + drive
return temp
if __name__ == '__main__':
bnm = input().split()
b = int(bnm[0])
n = int(bnm[1])
m = int(bnm[2])
keyboards = list(map(int, input().rstrip().split()))
drives = list(map(int, input().rstrip().split()))
moneySpent = getMoneySpent(keyboards, drives, b)
print(moneySpent)
'HackerRank Algorithm' 카테고리의 다른 글
[HackerRank] 26. forming a magic square (0) | 2020.04.07 |
---|---|
[HackerRank] 25. Cats and Mouse (0) | 2020.04.07 |
[HackerRank] 23. Apple and orange (0) | 2020.04.07 |
[HackerRank] 22. Between Two Sets (0) | 2020.04.07 |
[HackerRank] 21. Birthday cake candles (0) | 2020.04.01 |
댓글