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
    评论
PAT乙级1009题是一个关于字符串处理的题目。根据题目要求,我们需要将输入的字符串按照单词的逆序输出。根据提供的引用内容,我们可以看到有三种不同的解法。 引用\[1\]和引用\[2\]是两个相似的解法,使用了字符串处理函数strchr和strrchr来定位空格字符,并将字符串分割成单词。然后通过循环输出单词,最后输出剩余的最后一个单词。 引用\[3\]是另一种解法,使用了二维数组来存储每个单词。通过循环读取输入的字符串,直到遇到换行符为止。然后通过倒序循环输出每个单词。 根据题目要求,你可以选择其中一种解法来完成PAT乙级1009题。 #### 引用[.reference_title] - *1* [PAT考试乙级1009(C语言实现)](https://blog.csdn.net/JeffreyDDD/article/details/78395267)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [PAT乙级1009(C语言实现)](https://blog.csdn.net/weixin_62870950/article/details/124934829)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [PAT乙级测试题1009(C语言实现)](https://blog.csdn.net/weixin_45947840/article/details/105943475)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值