PAT 乙级 1058 选择题 python

题目
在这里插入图片描述
思路
根据信息统计学生成绩 和每道题错误学生的人数
根据要求输出

代码

stu_num,topic_num=map(int,(input().split()))

topic_all=[]
for i in range (topic_num):
    topic=list(input().split(' '))
    topic_all.append(topic)

stu_score=[0]*stu_num
topic_false=[0]*topic_num

for i in range(stu_num):
    stu_detail=list(input().split(') ('))
    for j in range(topic_num):
        stu_each_topic=list(stu_detail[j].replace('(' ,'').replace(')' ,'').split(' '))
        topic_choice_num=stu_each_topic[0]
        if topic_choice_num!=topic_all[j][2]: #正确选项数量不同
            topic_false[j]=topic_false[j]+1
            continue
        topic_choice_detail=stu_each_topic[1:]

        if topic_choice_detail!=topic_all[j][3:]: #正确选项不同
            topic_false[j] = topic_false[j] + 1
            continue

        stu_score[i]=stu_score[i]+int(topic_all[j][0])

for i in stu_score:
    print(i)

max_false_value=max(topic_false)
if max_false_value==0:
    print('Too simple')
else:
    false_print=[max_false_value]
    max_index=topic_false.index(max_false_value)
    false_print.append(max_index+1)
    for i in range(max_index+1,topic_num):
        if topic_false[i]==max_false_value:
            false_print.append(i+1)
    print((' ').join([str(i) for i in false_print]))
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值