Skip to content

Commit 31ba649

Browse files
Create S2_J5.py
1 parent c426a02 commit 31ba649

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

2016/Senior Problems/S2_J5.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
question = int(input())
2+
l = int(input())
3+
dmoj = list(map(int,input('').split(' ')))
4+
peg = list(map(int,input('').split(' ')))
5+
if question==1:
6+
dmoj.sort()
7+
peg.sort()
8+
ans = 0
9+
for e,t in enumerate(dmoj):
10+
ans+=max([t,peg[e]])
11+
print(ans)
12+
elif question==2:
13+
dmoj.sort()
14+
peg.sort()
15+
dmoj = dmoj[::-1]
16+
ans = 0
17+
for e,t in enumerate(dmoj):
18+
ans+=max([t,peg[e]])
19+
print(ans)

0 commit comments

Comments
 (0)