zgjja


私信TA

用户名:zgjja

访问量:10805

签 名:

X_X

等  级
排  名 147
经  验 7109
参赛次数 0
文章发表 71
年  龄 0
在职情况 学生
学  校
专  业 X_X

  自我简介:

原题地址:

题目 1500: [蓝桥杯][算法提高VIP]分数统计

解题思路:
    简单题,主要熟悉Python一些基本方法
注意事项:
    无
参考代码:

scores_a, scores_b, scores_c, scores_d, scores_e = [], [], [], [], []
n = int(input().strip())
scores = list(map(int, input().strip().split()))
for i in scores:
    if 0 <= i <= 59:
        scores_e.append(i)
    elif 60 <= i <= 69:
        scores_d.append(i)
    elif 70 <= i <= 79:
        scores_c.append(i)
    elif 80 <= i <= 89:
        scores_b.append(i)
    elif 90 <= i <= 100:
        scores_a.append(i)
len_a, len_b, len_c, len_d, len_e = len(scores_a), len(scores_b), len(scores_c), len(scores_d), len(scores_e)
print(len_a, len_b, len_c, len_d, len_e)
print(max(len_a, len_b, len_c, len_d, len_e))
temp = max(scores_a, scores_b, scores_c, scores_d, scores_e, key=lambda list_: len(list_))
temp.sort(reverse=True)
print(*temp)


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区