Alice and Bob each created one problem for HackerRank. A reviewer rates the two challenges, awarding points on a scale from to for three categories: problem clarity, originality, and difficulty.
We define the rating for Alice's challenge to be the triplet , and the rating for Bob's challenge to be the triplet .
Your task is to find their comparison points by comparing with , with , and with .
If , then Alice is awarded point.
If , then Bob is awarded point.
If , then neither person receives a point.
Comparison points is the total points a person earned.
Given and , can you compare the two challenges and print their respective comparison points?
#!/bin/python3
import sys
def solve(a0, a1, a2, b0, b1, b2):
a = (1 if a0 > b0 else 0) + (1 if a1 > b1 else 0) + (1 if a2 > b2 else 0)
b = (1 if a0 < b0 else 0) + (1 if a1 < b1 else 0) + (1 if a2 < b2 else 0)
return (a,b)
a0, a1, a2 = input().strip().split(' ')
a0, a1, a2 = [int(a0), int(a1), int(a2)]
b0, b1, b2 = input().strip().split(' ')
b0, b1, b2 = [int(b0), int(b1), int(b2)]
result = solve(a0, a1, a2, b0, b1, b2)
print (" ".join(map(str, result)))
#!/bin/python3
import sys
def solve(a0, a1, a2, b0, b1, b2):
result = []
a_arr = [a0, a1, a2]
b_arr = [b0, b1, b2]
for a, b in zip(a_arr, b_arr):
if a > b or a < b:
result.append(1)
return result
a0, a1, a2 = input().strip().split(' ')
a0, a1, a2 = [int(a0), int(a1), int(a2)]
b0, b1, b2 = input().strip().split(' ')
b0, b1, b2 = [int(b0), int(b1), int(b2)]
result = solve(a0, a1, a2, b0, b1, b2)
print (" ".join(map(str, result)))
행운의 77문제 프로젝트는 한 달동안 알고리즘 문제 77개를 푸는 프로젝트입니다.