Love丶FFC's Blog

PAT乙级:1047 编程团体赛

2020-03-09 16:57:45
阅读:2363   •   评论:27
标签:,

编程团体赛的规则为:每个参赛队由若干队员组成;所有队员独立比赛;参赛队的成绩为所有队员的成绩和;成绩最高的队获胜。

现给定所有队员的比赛成绩,请你编写程序找出冠军队。

输入格式:

输入第一行给出一个正整数 N(≤10​4​​),即所有参赛队员总数。随后 N 行,每行给出一位队员的成绩,格式为:队伍编号-队员编号 成绩,其中队伍编号为 1 到 1000 的正整数,队员编号为 1 到 10 的正整数,成绩为 0 到 100 的整数。

输出格式:

在一行中输出冠军队的编号和总成绩,其间以一个空格分隔。注意:题目保证冠军队是唯一的。

输入样例:

6
3-10 99
11-5 87
102-1 0
102-3 100
11-9 89
3-2 61

输出样例:

11 176

编程语言:Python

解题思想:

1.与1042题相似,不再赘述,请移步查看

时间复杂度:O(N)

代码如下:

  1. NOP = int(input()) # 输入参赛队员人数
  2. TeamID = list() # 记录每个队伍的编号
  3. TeamScore = list() # 记录每个队伍的总成绩
  4.  
  5. for i in range(NOP):
  6. ID, PersonalScore = input().split() # 输入编号、个人成绩
  7. ID = str(ID)
  8. if ID[:ID.find('-')] not in TeamID: # 该该队伍编号首次出现
  9. TeamID.append(ID[:ID.find('-')])
  10. TeamScore.append(int(PersonalScore))
  11. else: # 该队伍编号出现过
  12. TeamScore[TeamID.index(ID[:ID.find('-')])] += int(PersonalScore)
  13.  
  14. # TeamID与TeamScore是一一对应的关系,因此下标也相同
  15. print(TeamID[TeamScore.index(max(TeamScore))], max(TeamScore))

评论板

共有 27 条评论

  1. Abupguele

    The anti SSEA 3 SSEA 4 GLOBO H monoclonal antibodies of the invention can be made using a variety of methods known in the art, including the hybridoma method first described by Kohler et al where to buy cialis online

  2. Outlils

    propecia prostate cancer CRISPR generated lines, on the other hand, contain indels or mutations which may affect transgene expression

  3. louis vuitton outlet online

    I just wanted to thank you for the fast service. or alternatively they look great. I received them a day earlier than expected. themselves I will definitely continue to buy from this site. in any event I will recommend this site to my friends. Thanks!
    louis vuitton outlet online https://www.louisvuittonsoutletstore.com/

  4. cheap louis vuitton online

    I just wanted to thank you for the fast service. or simply they look great. I received them a day earlier than expected. exactly like the I will definitely continue to buy from this site. an invaluable I will recommend this site to my friends. Thanks!
    cheap louis vuitton online https://www.cheapreallouisvuitton.com/

  5. authentic cheap jordans

    I just wanted to thank you for the fast service. or perhaps they look great. I received them a day earlier than expected. such as I will definitely continue to buy from this site. either way I will recommend this site to my friends. Thanks!
    authentic cheap jordans https://www.cheaprealjordan.com/

  6. authentic louis vuitton outlet

    I just wanted to thank you for the fast service. and also they look great. I received them a day earlier than expected. like I will definitely continue to buy from this site. regardless I will recommend this site to my friends. Thanks!
    authentic louis vuitton outlet https://www.bestlouisvuittonoutlet.com/

  7. authentic cheap jordans

    I just wanted to thank you for the fast service. or maybe a they look great. I received them a day earlier than expected. love the I will definitely continue to buy from this site. you ultimately choose I will recommend this site to my friends. Thanks!
    authentic cheap jordans https://www.realjordansretro.com/

  8. FoorryNox

    cialis on sale in usa The empirical formula is C 17 H 22 N 2 O C 4 H 6 O 4 and the molecular mass is 388

  9. cheap retro jordans

    Read reviews and was a little hesitant since I had already inputted my order. perhaps but thank god, I had no issues. love the received item in a timely matter, they are in new condition. blue jays so happy I made the purchase. Will be definitely be purchasing again.
    cheap retro jordans https://www.cheapsneakeronline.com/

  10. cheap louis vuitton bags

    Read reviews and was a little hesitant since I had already inputted my order. or maybe but thank god, I had no issues. decline received item in a timely matter, they are in new condition. anyway so happy I made the purchase. Will be definitely be purchasing again.
    cheap louis vuitton bags https://www.louisvuittonsoutletonline.com/

  11. invoimi

    In children and young adults usually between the ages of 16 and 40 it s called young onset rheumatoid arthritis YORA discount cialis WNT4 and RANKL are effectors of progesterone signaling

  12. Preliaf

    Again, they may charge higher copayments for brand name drugs, or limit reimbursement to the generic price even when the brand name drug has been dispensed viagra and cialis online

  13. invoimi

    I think we all agree in here, in this room, that it s a crisis how to take priligy Patients characteristics were well balanced between the two treatment arms Table 1

  14. gucci white bags

    Look at the double G LOGO

  15. cheap real retro jordans

    $ 93.18 Cheap Jordans VII (7) Retro Cigar Championship

  16. cheap air jordans

    $ 84.18 Cheap Jordans 11 Low Concord

  17. gucci over shoulder bags

    LOOK 3: Gray suit West + dark brown double-sided woolen coat + brown trim double G yarn-dyed pattern 1955

  18. Preliaf

    As introduced above, many studies on lifestyle induced weight loss have been performed on breast cancer survivors because these cohorts typically show excellent study retention rates and adherence to lifestyle intervention plans 85 lower price on finasteride camber Next step in management now is amniocentesis, looking for amniotic fluid aFP, which is much more specific

  19. eWSzNP

    buying generic propecia online Kate stared at him for a while before saying, We how to lower blood pressure blood pressure found out the whereabouts of the other party s patrol

  20. puOgdFHNp

    Weekly dosages of 700 to 800 milligrams and above are classified as a high dose buy cialis The space constructed by the Thunder Fire Barrier is more perfect, can furosemide cause gout and under Calvin s control, it can also change its appearance and make a disguise

  21. Mobhpt

    fenofibrate 160mg canada order fenofibrate 160mg sale buy fenofibrate without prescription

  22. LzVRYjaR

    Since neither the serum levels of the drugs nor their antibacterial efficacy were compromised, antioxidant therapy appeared promising for a clinical application cialis 20mg price Jak2 RL Tet2 bone marrow cells harvested at timed sacrifice 21 weeks and scored at day 8 after each plating each sample plated in triplicate, representative of n 2 independent experiments, mean s

  23. Thksnu

    tadalafil 10mg uk cheap viagra pill viagra 50mg cheap

  24. Fymvip

    order zaditor for sale pill tofranil 75mg imipramine 75mg drug

  25. Ebjkxi

    minoxidil canada medications for ed best pills for ed

  26. Ojhjql

    buy acarbose 25mg online repaglinide 2mg generic order fulvicin 250 mg

--------查看该分类下最新文章--------
^
新版博客正在完善中!域名:http://www.loveffc:8080,点击跳转,完全移植后将去除端口号。

Copyright © 2018 - 2021 FFC的小站 - 滇 ICP 备 18010780 号 - 1

- Powered by WordPress & AliYun · Theme by FFC -

- Environment by Windows & XAMPP · Designed by WebStorm & VSCode -

已运行:

访问量:498705