1073 多选题常见计分法 难度低但繁琐

代码

#include <iostream>
#include <cstdio>
#include <string>
#include <iomanip>
using namespace std;
float point[101];
int num[101];
int rnum[101];
float stu[1001];
string answer[101];
int w[101][5];
bool sub_str(string a,string b){
	for(int i=0;b[i]!=NULL;i++){
		if(a.find(b[i])==string::npos){//找不到 
			return 0;
		}
		else{
			
		} 
	}
	return 1;
}
int main()
{
	int n,m;
	string sanswer;
	char ch='!';
	int a;
	int max=-99;
	int maxi;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		stu[i]=0;
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<5;j++){
			w[i][j]=0;
		}
	}
	for(int i=0;i<m;i++){
		cin>>point[i]>>num[i]>>rnum[i];
		getline(cin,answer[i]);
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			while(ch!='('){
				ch=getchar();
			}
			if(ch=='('){
				cin>>a;
				getline(cin,sanswer,')');
				if(a>rnum[j]){//错 
					
				}
				else{
					if(sanswer==answer[j]){//正确 
						stu[i]+=point[j];
//						cout<<"i: "<<i<<" j: "<<j<<" stu: "<<stu[i]<<" p: "<<point[j]<<endl;
					}
					else{
						if(sub_str(answer[j],sanswer)==1){//对一半 
							stu[i]+=(0.5*point[j]);
//							cout<<"**i: "<<i<<" j: "<<j<<" stu: "<<stu[i]<<" p: "<<point[j]<<endl;
						} 
						else{//错 
							
						}
					}
				}	
				if(sub_str(answer[j],"a")!=sub_str(sanswer,"a")){
					w[j][0]++;
				}
				if(sub_str(answer[j],"b")!=sub_str(sanswer,"b")){
					w[j][1]++;
				}
				if(sub_str(answer[j],"c")!=sub_str(sanswer,"c")){
					w[j][2]++;
				}
				if(sub_str(answer[j],"d")!=sub_str(sanswer,"d")){
					w[j][3]++;
				}
				if(sub_str(answer[j],"e")!=sub_str(sanswer,"e")){
					w[j][4]++;
				}				
			}
			ch='!';	
		}	
	}
	for(int i=0;i<n;i++){
		cout<<fixed<<setprecision(1)<<stu[i]<<endl;
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<5;j++){
			if(max<w[i][j]){
				maxi=i;
				max=w[i][j];
			}	
		}
	}
	if(max<=0){
		cout<<"Too simple";
		return 0;
	}
	int tmp=0;
	char tmp2;
	for(int i=0;i<m;i++){
		for(int j=0;j<5;j++){
			if(max==w[i][j]){
				tmp2=j+'a';
				if(tmp==0){
					cout<<max<<" "<<i+1<<"-"<<tmp2;
					tmp=1;
				}
				else{
					cout<<endl<<max<<" "<<i+1<<"-"<<tmp2;
				}
			}	
		}
	}
	return 0;
}
posted @   qwasdasd  阅读(24)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示