当前位置:网站首页>PTA 1082 shooting competition (20 points)
PTA 1082 shooting competition (20 points)
2022-06-24 05:12:00 【freesan44】
subject
The rules of shooting competition given in this topic are very simple , Who shot the hole closest to the bull's eye , Who is the champion ; Who is the worst , Who is a rookie . This problem gives the plane coordinates of a series of bullet holes (x,y), Please write a program to find out the champion and rookie . Let's assume that the bull's-eye is at the origin (0,0).
Input format :
Input gives a positive integer in the first line N(≤ 10 000). And then N That's ok , Each line is given in the following format :
ID x y
among ID It's the athlete's number ( from 4 Digit composition );x and y Is the plane coordinate of the bullet hole it hit (x,y), All are integers , And 0 ≤ |x|, |y| ≤ 100. The title ensures that the number of each athlete is not repeated , And everyone only plays 1 gun .
Output format :
Output the number of champion and rookie , The middle space 1 grid . The title guarantees that they are the only .
sample input : 3 0001 5 7 1020 -1 3 0233 0 -1 No blank lines at the end sample output : 0233 0001 No blank lines at the end
Their thinking
inputCount = int(input())
# inputCount = 3
menberNoList = []
menberLengthList = []
for i in range(inputCount):
inputList = input().split(" ")
# inputList = "0001 5 7".split(" ")
menberNoList.append(inputList[0])
x = abs(int(inputList[1]))
y = abs(int(inputList[2]))
# You can use the square root , But that's one less layer
length = x*x + y*y
menberLengthList.append(length)
# Get the longest and shortest distance index
maxIndex = menberLengthList.index(max(menberLengthList))
minIndex = menberLengthList.index(min(menberLengthList))
print(str(menberNoList[minIndex]) + " " + str(menberNoList[maxIndex]))边栏推荐
- Here's all you want to know about takin data (1) startup command
- Bi-sql - Select
- Shutter - how to copy certain elements from a map to a new map in dart/shutter?
- What are clustering, distribution, and microservices?
- Many regulations come into effect today! The main responsibility of network security will be further implemented
- Hard core observation 553 AI needs to identify almost everyone in the world with hundreds of billions of photos
- API service orchestration platform, full web visual orchestration
- Eigen eigenMatrix
- Bi-sql basic cognition
- How unity runs code every few frames
猜你喜欢

What is the new generation cloud computing architecture cipu of Alibaba cloud?

Leetcode question brushing (question 3) - the longest substring without repeated characters

014_ TimePicker time selector

Analysis on the subjective enthusiasm of post-90s makers' Education

让孩子们学习Steam 教育的应用精髓

Leetcode (question 1) - sum of two numbers

Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players
![[leetcode daily question] push domino](/img/81/1c31e97d9a245816514bcf47c92107.jpg)
[leetcode daily question] push domino

Introduction to the "penetration foundation" cobalt strike Foundation_ Cobalt strike linkage msfconsole

011_ Cascader cascade selector
随机推荐
Spirit breath development log (15)
Locating memory leaks with poolmon
Training methods after the reform of children's programming course
Redis pipeline technology speed and efficiency increased by 5 times
Functional advantages of industrial wireless router
Understanding OAuth 2.0
The easyplayer player displays compileerror:webassembly Reason for instance() and its solution
What's wrong with the failure of uploading web pages to ECS? How many kinds of servers are there
The function of nearby people in the applet is realized, and the cloud development database is used to realize nearby people and friends within a distance of the neighborhood
Tencent cloud audio and video award-winning evaluation | leave online messages or submit evaluation, win Dajiang UAV /iphone/switch and other awards
Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players
Why do hybrid clouds exist?
Bi-sql and & or & in
Svg quick start small white article
Precautions for online education and training industry filing
Confluence data center version is nearing its lifecycle
Tencent cloud installs Kedao cloud - build an exclusive private cloud disk
What is required for domain name filing and how to select an enterprise domain name
Ext4 file system jam caused by MEM CGroup OOM
Oracle database prompts no operation permission