当前位置:网站首页>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;
}
边栏推荐
- idea使用@Autowired注解爆红原因及解决方法
- Get the Ip tool class
- Coordinate knowledge in digital twin campus scenarios
- 接口测试框架实战(三)| JSON 请求与响应断言
- 【 Harmony OS 】 【 ano UI 】 lightweight data storage
- Super handy drawing tool is recommended
- js的垃圾回收机制
- typescript47-函数之间的类型兼容性
- The problem that the rosbag tool plotjuggler cannot open rosbag
- JS底层手写
猜你喜欢

Shell条件语句判断

typescript43-类型兼容性说明

c语言结构体中的冒泡排序

接口测试框架实战(四)| 搞定 Schema 断言

常见亲脂性细胞膜染料DiO, Dil, DiR, Did光谱图和实验操作流程

Interface Test Framework Practice (4) | Get Schema Assertion

设计模式——组合模式、享元模式(Integer缓存)(结构型模式)

js implements a bind function

多肽介导PEG磷脂——靶向功能材料之DSPE-PEG-RGD/TAT/NGR/APRPG

Coordinate knowledge in digital twin campus scenarios
随机推荐
MOSN 反向通道详解
Harmony OS Date ano UI 】 【 】 the basic operation
Build your own web page on raspberry pie (1)
测试人员的价值体现在哪里
Windows 安装PostgreSQL
Bubble sort in c language structure
typescript46-函数之间的类型兼容性
C# async and multithreading
在树莓派上搭建属于自己的网页(2)
【Harmony OS】【FAQ】Hongmeng Questions Collection 1
内部类、static关键字、final
Technology Sharing | How to do assertion verification for xml format in interface automation testing?
Harmony OS ets ArkUI 】 【 】 the development basic page layout and data connection
【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed
【Harmony OS】【FAQ】鸿蒙问题合集1
WinForm的控件二次开发
接口测试 Mock 实战(二) | 结合 jq 完成批量化的手工 Mock
JS bottom handwriting
GIS数据漫谈(五)— 地理坐标系统
接口测试框架实战(一) | Requests 与接口请求构造