当前位置:网站首页>1058 选择题 (20 分)(C语言)
1058 选择题 (20 分)(C语言)
2022-08-03 05:09:00 【破烂摆烂人】
批改多选题是比较麻烦的事情,本题就请你写个程序帮助老师批改多选题,并且指出哪道题错的人最多。
输入格式:
输入在第一行给出两个正整数 N(≤ 1000)和 M(≤ 100),分别是学生人数和多选题的个数。随后 M 行,每行顺次给出一道题的满分值(不超过 5 的正整数)、选项个数(不少于 2 且不超过 5 的正整数)、正确选项个数(不超过选项个数的正整数)、所有正确选项。注意每题的选项从小写英文字母 a 开始顺次排列。各项间以 1 个空格分隔。最后 N 行,每行给出一个学生的答题情况,其每题答案格式为 (选中的选项个数 选项1 ……),按题目顺序给出。注意:题目保证学生的答题情况是合法的,即不存在选中的选项数超过实际选项数的情况。
输出格式:
按照输入的顺序给出每个学生的得分,每个分数占一行。注意判题时只有选择全部正确才能得到该题的分数。最后一行输出错得最多的题目的错误次数和编号(题目按照输入的顺序从 1 开始编号)。如果有并列,则按编号递增顺序输出。数字间用空格分隔,行首尾不得有多余空格。如果所有题目都没有人错,则在最后一行输出 Too simple。
输入样例:
3 4
3 4 2 a c
2 5 1 b
5 3 2 b c
1 5 4 a b d e
(2 a c) (2 b d) (2 a c) (3 a b e)
(2 a c) (1 b) (2 a b) (4 a b d e)
(2 b d) (1 e) (2 b c) (4 a b c d)
输出样例:
3
6
5
2 2 3 4
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
struct problem{
int scare ;
int num1 ;
int num2 ;
char ch1[10] ;
}P[100] ;
struct answer{
int num[100] ;
char ch2[100][10] ;
}A[1000] ;
int main(int argc, char *argv[]) {
int n , m ;
int count[100] = {
0 }; //每题错误个数
scanf("%d %d",&n,&m) ;
int i , j , k ; //循环变量
//读取problem的信息
for( i = 0 ; i < m ; i++ ){
scanf("%d %d %d",&P[i].scare,&P[i].num1,&P[i].num2) ;
for( j = 0 ; j < P[i].num2 ; j++ ){
scanf(" %c",&P[i].ch1[j]) ;
}
}
for( i = 0 ; i < n ; i++ ){
//每个学生的总分
getchar();
for( j = 0 ; j < m - 1 ; j++ ){
scanf("(") ;
scanf("%d",&A[i].num[j]) ;
for( k = 0 ; k < A[i].num[j] ; k++ ){
scanf(" %c",&A[i].ch2[j][k]) ;
}
scanf(") ") ;
}
scanf("(") ;
scanf("%d",&A[i].num[j]) ;
for( k = 0 ; k < A[i].num[j] ; k++ ){
scanf(" %c",&A[i].ch2[j][k]) ;
}
scanf(")") ;
}
getchar() ;
for( i = 0 ; i < n ; i++ ){
int sum = 0 ;
for( j = 0 ; j < m ; j++ ){
int flag = 1 ;
if( A[i].num[j] == P[j].num2){
for( k = 0 ; k < A[i].num[j] ; k++ ){
if( P[j].ch1[k]!=A[i].ch2[j][k] ){
count[j]++ ;
flag = 0 ;
break ;
}
}
}else{
flag = 0 ;
count[j]++ ;
}
if( flag == 1 ){
sum += P[j].scare ;
}
}
printf("%d\n",sum) ;
}
int max = 0;
for( i = 0 ; i < m ; i++ ){
if( max < count[i] ){
max = count[i] ;
}
}
if( max == 0 ){
printf("Too simple") ;
}else{
printf("%d",max) ;
for( i = 0 ; i < m ; i++ ){
if( max == count[i] ){
printf(" %d",i+1) ;
}
}
}
return 0;
}
边栏推荐
- Fluorescent marker peptides FITC/AMC/FAM/Rhodamine TAMRA/Cy3 / Cy5 / Cy7 - Peptide
- Interface Test Framework Practice (4) | Get Schema Assertion
- typescript47-函数之间的类型兼容性
- 接口和抽象
- Alienware上线首个数字时装AR试穿体验
- js garbage collection mechanism
- 接口管理工具YApi怎么用?颜值高、易管理、超好用
- Build your own web page on raspberry pie (1)
- 接口测试框架实战(一) | Requests 与接口请求构造
- typescript41-class类的私有修饰符
猜你喜欢
BIOTIN ALKYNE CAS:773888-45-2价格,供应商
在竞争白热化的电商行业,链动2+1为什么还有企业在用
Kotlin-Flow常用封装类:StateFlow的使用
Super handy drawing tool is recommended
typescript49-交叉类型
How to prepare for the test interface test data
【Harmony OS】【ARK UI】Date 基本操作
测试人员的价值体现在哪里
接口测试框架实战(四)| 搞定 Schema 断言
安装IIS服务(Internet信息服务(Internet Information Services,简写IIS,互联网信息服务)
随机推荐
typescript49-交叉类型
【Harmony OS】【ARK UI】轻量级数据存储
js的垃圾回收机制
Secondary development of WinForm controls
WebSocket的实际应用
常见荧光染料修饰多种基团及其激发和发射波长数据一览数据
WinForm的控件二次开发
Interface test framework combat (1) | Requests and interface request construction
2022/08/02 Study Notes (day22) Multithreading
【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed
Kotlin-Flow常用封装类:StateFlow的使用
接口测试框架实战 | 流程封装与基于加密接口的测试用例设计
JS bottom handwriting
在树莓派上搭建属于自己的网页(2)
[Developers must see] [push kit] Collection of typical problems of push service service 2
Talking about GIS Data (5) - Geographic Coordinate System
索引创建、删除与使用
用户密码验证
在线密码生成工具推荐
【软件工程之美 - 专栏笔记】35 | 版本发布:软件上线只是新的开始