PAT B 1082 shooting competitions

The code was released, we learn together, help each other
Title:
Here Insert Picture Description
Input Sample:

3
0001 5 7
1020 -1 3
0233 0 -1

Sample output:

0233 0001

Code below (Python):

n = int(input())
result = []
number = []
for i in range(n):
    x, y, z = input().split()
    y = int(y)
    z = int(z)
    result.append(y**2 + z**2)
    number.append(x)
print(number[result.index(min(result))], end=' ')
print(number[result.index(max(result))])
Published 65 original articles · won praise 25 · views 1029

Guess you like

Origin blog.csdn.net/chongchujianghu3/article/details/104987215