alice랑 bob이 차례로 3개 점수 내는데 동점은 둘다 0, 둘중 큰 수면 큰수인 사람이 1점 가져가는 걸 compareTriplets 함수로 짜면 된다.
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the compareTriplets function below.
def compareTriplets(a, b):
result=[0,0]
for i in range(3):
if a[i]>b[i]:
result[0]=result[0]+1
elif a[i]<b[i]:
result[1]=result[1]+1
else:
continue
return result
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
a = list(map(int, input().rstrip().split()))
b = list(map(int, input().rstrip().split()))
result = compareTriplets(a, b)
fptr.write(' '.join(map(str, result)))
fptr.write('\n')
fptr.close()
[HackerRank] A Very Big Sum (Algorithm) (0) | 2021.01.05 |
---|---|
[HackerRank] Simple Array Sum (Algorithm) (0) | 2021.01.04 |
[HackerRank] Arrays - DS (Data Structure) (0) | 2021.01.04 |
[Leet Code] 1-bit and 2-bit Characters (python3) (0) | 2020.03.25 |
[Leet Code] Two sums (Java) (0) | 2020.03.25 |