PAT乙级1080 MOOC期终成绩 (25 分)测试点3

博客内容涉及PAT乙级考试中1080题目的期终成绩测试点3,指出在这个测试点中,即使总分59.5也被认为合格,作者认为这一规定可能具有争议。文章提到题目本身并不复杂,但使用map解决显得较为繁琐。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://pintia.cn/problem-sets/994805260223102976/problems/994805261493977088
测试点3是指总分是59.5也算合格,,是不是很坑??
题不难 用map 很麻烦

#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
struct node{
	double G1 = -1, G2 = -1, G3 = -1, G = 0.0;
	string name;
};
bool cmp(node a, node b){
	if((int)(a.G+0.5) == (int)(b.G+0.5))	return a.name < b.name;
	else	return a.G > b.G;
}
node stu[30003];
int main(){
	map<string, int> match;
	int m, n, k, sub = 1;
	cin >> m >> n >> k;
	for(int i = 1; i <= m; i++){
		cin >> stu[i].name >> stu[i].G1;
		match[stu[i].name] = sub++;
	}
	for(int i = 0; i < n; i++){
		string tmpn;
		int tmps;
		cin >> tmpn >> tmps;
		if(match[tmpn])
			stu[match[tmpn]].G2 = tmps;
		else{
			stu[sub].name = tmpn;
			stu[sub].G2 = tmps;
	
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值