当前位置:网站首页>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;
}
边栏推荐
- Alienware上线首个数字时装AR试穿体验
- 【Harmony OS】【ARK UI】轻量级数据存储
- VR全景展打造专属元宇宙观展空间
- High availability, two locations and three centers
- Detailed explanation of MOSN reverse channel
- 在树莓派上搭建属于自己的网页(2)
- 内部类、static关键字、final
- shell script loop statement
- Technology Sharing | How to do assertion verification for xml format in interface automation testing?
- 用户密码加密工具
猜你喜欢

2022/08/02 学习笔记 (day22) 多线程

Harmony OS Date ano UI 】 【 】 the basic operation
![[Harmony OS] [ARK UI] ETS context basic operations](/img/40/d5924477c42e2b3246eb212f4be534.png)
[Harmony OS] [ARK UI] ETS context basic operations

Kotlin-Flow common encapsulation class: the use of StateFlow

Interface Test Framework Practice (4) | Get Schema Assertion

超好用的画图工具推荐

Common fluorescent dyes to modify a variety of groups and its excitation and emission wavelength data in the data

【Harmony OS】【ARK UI】轻量级数据存储

Windows 安装PostgreSQL

Interface Test Framework Practice | Process Encapsulation and Test Case Design Based on Encrypted Interface
随机推荐
传统企业如何转型社交电商,泰山众筹的玩法有哪些?
typescript41-class类的私有修饰符
CAD有生僻字如何打出来、如何提交软件相关问题或建议?
【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed
接口和抽象
rosbag工具plotjuggler无法打开rosbag的问题
User password encryption tool
Bubble sort in c language structure
shell脚本循环语句
Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)
Ali cloud object storage oss private barrels to generate links
Shell conditional statement judgment
Kotlin-Flow common encapsulation class: the use of StateFlow
软件开发的最大的区别是什么?
Peptides mediated PEG DSPE of phospholipids, targeted functional materials - PEG - RGD/TAT/NGR/APRPG
【生物素叠氮化物|cas:908007-17-0】价格_厂家
odps的临时查询能在写sql的时候就给结果一个命名不?
私域流量时代来临,电商企业如何布局?
设计模式——组合模式、享元模式(Integer缓存)(结构型模式)
Tag stack - stack monotonically preparatory knowledge - lt. 739. The daily temperature