1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
pydef cal_score(x,y):
score=0
distance=x**2+y**2
if distance<=9 :
score = 100
elif distance<=36 :
score = 80
elif distance<=81 :
score = 60
elif distance<=144 :
score = 40
elif distance<=225 :
score = 20
else :
score = 0
return score
def sol(nums):
p1_score,p2_score=0,0
for i in range(3):
p1_score+=cal_score(nums[2*i],nums[2*i+1])
for i in range(3,6):
p2_score += cal_score(nums[2 * i], nums[2 * i + 1])
if p1_score>p2_score:
print('SCORE: %d to %d, PLAYER 1 WINS.'%(p1_score,p2_score))
elif p1_score==p2_score:
print('SCORE: %d to %d, TIE.'%(p1_score,p2_score))
else:
print('SCORE: %d to %d, PLAYER 2 WINS.'%(p1_score,p2_score))
for _ in range(int(input())):
nums=list(map(float, input().split()))
sol(nums)
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 509. Fibonacci Number (0) | 2022.07.06 |
---|---|
leetcode 462. Minimum Moves to Equal Array Elements II (0) | 2022.06.30 |
백준 14647 준오는 조류혐오야!! (0) | 2022.06.16 |
codeforces 509A - Maximum in Table (0) | 2022.06.13 |
백준 23809 골뱅이 찍기 - 돌아간 ㅈ (0) | 2022.06.10 |
댓글