Love丶FFC's Blog

PAT乙级:1077 互评成绩计算

2020-04-09 23:43:18
阅读:8865   •   评论:168
标签:,

在浙大的计算机专业课中,经常有互评分组报告这个环节。一个组上台介绍自己的工作,其他组在台下为其表现评分。最后这个组的互评成绩是这样计算的:所有其他组的评分中,去掉一个最高分和一个最低分,剩下的分数取平均分记为 G​1​​;老师给这个组的评分记为 G​2​​。该组得分为 (G​1​​+G​2​​)/2,最后结果四舍五入后保留整数分。本题就要求你写个程序帮助老师计算每个组的互评成绩。

输入格式:

输入第一行给出两个正整数 N(> 3)和 M,分别是分组数和满分,均不超过 100。随后 N 行,每行给出该组得到的 N 个分数(均保证为整型范围内的整数),其中第 1 个是老师给出的评分,后面 N−1 个是其他组给的评分。合法的输入应该是 [0,M] 区间内的整数,若不在合法区间内,则该分数须被忽略。题目保证老师的评分都是合法的,并且每个组至少会有 3 个来自同学的合法评分。

输出格式:

为每个组输出其最终得分。每个得分占一行。

输入样例:

6 50
42 49 49 35 38 41
36 51 50 28 -1 30
40 36 41 33 47 49
30 250 -25 27 45 31
48 0 0 50 50 1234
43 41 36 29 42 29

输出样例:

42
33
41
31
37
39

编程语言:Python

解题思想:

1.只保留合法分数

2.去除一个最高分、最低分

3.四舍五入判断

时间复杂度:O(N^2)

代码如下:

  1. NOG, FullPoint = map(int, input().split()) # 输入组数、满分
  2. Score = list() # 记录一行输入的分数
  3.  
  4. for i in range(NOG):
  5. Score = list(map(int, input().split())) # 输入一行的分数
  6. G1 = Score[0]
  7. Score.pop(0) # 将老师所给的分数删除,只留下其他组所给的分数
  8. GroupScore = list() # 存放其他组所给的合法的分数
  9.  
  10. for j in range(len(Score)):
  11. if 0 <= Score[j] <= FullPoint: # 该分数合法
  12. GroupScore.append(Score[j])
  13.  
  14. GroupScore.remove(max(GroupScore)) # 去除一个最高分
  15. GroupScore.remove(min(GroupScore)) # 去除一个最低分
  16.  
  17. G2 = sum(GroupScore) / len(GroupScore)
  18.  
  19. if (G1 + G2) / 2 - int((G1 + G2) / 2) >= 0.5: # 入
  20. print(int((G1 + G2) / 2) + 1)
  21. else: # 舍
  22. print(int((G1 + G2) / 2))

评论板

共有 168 条评论

  1. Jorcift

    Kao YC, Zhou C, Sherman M, Laughton CA, Chen S is lisinopril like viagra

  2. cheap louis vuitton online

    I just wanted to thank you for the fast service. to they look great. I received them a day earlier than expected. which includes I will definitely continue to buy from this site. you decide I will recommend this site to my friends. Thanks!
    cheap louis vuitton online https://www.bestlouisvuittonoutlet.com/

  3. authentic louis vuitton outlet

    I just wanted to thank you for the fast service. otherwise they look great. I received them a day earlier than expected. as good as the I will definitely continue to buy from this site. you ultimately choose I will recommend this site to my friends. Thanks!
    authentic louis vuitton outlet https://www.cheapreallouisvuitton.com/

  4. cheap jordans online

    I just wanted to thank you for the fast service. nor they look great. I received them a day earlier than expected. choose the I will definitely continue to buy from this site. blue jays I will recommend this site to my friends. Thanks!
    cheap jordans online https://www.realcheapretrojordanshoes.com/

  5. cheap retro jordans

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

  6. cheap jordans

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

  7. cheap real jordans

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

  8. cheap louis vuitton

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

  9. cheap louis vuitton

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

  10. intuido

    Optimally you would start making love every 1- 2 days starting on 01 11 2018 finpecia fast delivery overnight

  11. intuido

    buy priligy 60 mg 11 Although the MAPK, NF ОєB, and AKT signaling pathways all contribute to the development of cardiac hypertrophy, the role of TRAF3 in the heart, particularly in response to stress, remains elusive

  12. cheap louboutin heels

    |Wear darker blouses and pants if you want to appear slimmer. Dark colors help emphasize your good parts and tone down the overweight extras you don’t want people to notice. You should wear skirts with elastic waistbands if you are concerned about comfort.

  13. https://maps.google.co.jp/url?q=https://www.topchristianlouboutinoutlet.com/

    |Don’t buy something simply because of a great price. No matter how much of a steal it is money wise, if it looks bad on you, don’t buy it. It will simply be a loss of space and money.

  14. CLCGHlb

    42, total mortality RR 1 can you buy priligy online

  15. Zuudwt

    order tricor online cheap fenofibrate brand purchase fenofibrate online

  16. Rtgcgx

    buy tadalafil 20mg sale us pharmacy viagra oral sildenafil 50mg

  17. Pjflve

    zaditor 1 mg canada order ziprasidone 80mg generic tofranil 25mg pills

  18. Trwmog

    order minoxytop online best ed pill buy ed pills

  19. Ogqrjj

    precose 50mg pills order fulvicin online order fulvicin 250 mg sale

--------查看该分类下最新文章--------
^
新版博客正在完善中!域名: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 -

已运行:

访问量:503532