当前位置:网站首页>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;
}
边栏推荐
- rosbag工具plotjuggler无法打开rosbag的问题
- Interface testing framework combat (3) | JSON request and response assertion
- 打破传统电商格局,新型社交电商到底有什么优点?
- typescript47-函数之间的类型兼容性
- 建立树形结构
- Interface testing framework of actual combat (2) | interface request assertion
- Kotlin-Flow常用封装类:StateFlow的使用
- Apache DolphinScheduler版本2.0.5分布式集群的安装
- CAD有生僻字如何打出来、如何提交软件相关问题或建议?
- 常见荧光染料修饰多种基团及其激发和发射波长数据一览数据
猜你喜欢
随机推荐
Install PostgreSQL on Windows
Interface Test Framework Practice (4) | Get Schema Assertion
High availability, two locations and three centers
JS bottom handwriting
接口测试框架实战 | 流程封装与基于加密接口的测试用例设计
shell script loop statement
js garbage collection mechanism
Common lipophilic cell membrane dyes DiO, Dil, DiR, Did spectrograms and experimental procedures
Concepts and Methods of Exploratory Testing
技术分享 | 接口自动化测试中如何对xml 格式做断言验证?
Jmeter 模拟多用户登录的两种方法
【Harmony OS】【ArkUI】ets开发 图形与动画绘制
Get the Ip tool class
CobalStrike(CS)基础超级详细版
打破传统电商格局,新型社交电商到底有什么优点?
BIOTIN ALKYNE CAS:773888-45-2价格,供应商
【Harmony OS】【ARK UI】Date 基本操作
三丁基-巯基膦烷「tBuBrettPhos Pd(allyl)」OTf),1798782-17-8
用户密码加密工具
typescript44-对象之间的类兼容器








