PAT甲级1012 The Best Rank (25分)

本文介绍了一个针对计算机科学专业一年级学生的成绩排名系统。该系统通过比较学生在C语言编程、数学和英语三门课程的成绩,确定每位学生的最佳排名,并考虑了平均成绩。系统优先考虑平均成绩,其次是各科目成绩。

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

原题目:

To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - English. At the mean time, we encourage students by emphasizing on their best ranks -- that is, among the four ranks with respect to the three courses and the average grade, we print the best rank for each student.

For example, The grades of C, M, E and A - Average of 4 students are given as the following:

StudentID  C  M  E  A
310101     98 85 88 90
310102     70 95 88 84
310103     82 87 94 88
310104     91 91 91 91

Then the best ranks for all the students are No.1 since the 1st one has done the best in C Programming Language, while the 2nd one in Mathematics, the 3rd one in English, and the last one in average.

Input Specification:

Each input file contains one test case. Each case starts with a line containing 2 numbers NNN and MMM (≤2000\le 20002000), which are the total number of students, and the number of students who would check their ranks, respectively. Then NNN lines follow, each contains a student ID which is a string of 6 digits, followed by the three integer grades (in the range of [0, 100]) of that student in the order of C, M and E. Then there are MMM lines, each containing a student ID.

Output Specification:

For each of the MMM students, print in one line the best rank for him/her, and the symbol of the corresponding rank, separated by a space.

The priorities of the ranking methods are ordered as A >>> C >>> M >>> E. Hence if there are two or more ways for a student to obtain the same best rank, output the one with the highest priority.

If a student is not on the grading list, simply output N/A.

Sample Input:

5 6
310101 98 85 88
310102 70 95 88
310103 82 87 94
310104 91 91 91
310105 85 90 90
310101
310102
310103
310104
310105
999999

Sample Output:

1 C
1 M
1 E
1 A
3 A
N/A
源代码:
#include<iostream>
#include<algorithm>
using namespace std;
struct Student{
    int id;
    int cl;
    int math;
    int eng;
    int ave;
};
bool cmp1(Student s1, Student s2){
    return s1.cl > s2.cl;
}
bool cmp2(Student s1, Student s2){
    return s1.math > s2.math;
}
bool cmp3(Student s1, Student s2){
    return s1.eng > s2.eng;
}
bool cmp4(Student s1, Student s2){
    return s1.ave > s2.ave;
}
int main(){
    int n, m;
    cin>>n>>m;
    char c[4] = {'C', 'M', 'E', 'A'};
    int wc[m];
    int sortnum[m];
    char sortclass[m];
    Student stu[n];
    for(int i = 0; i < n; i ++){
        cin>>stu[i].id>>stu[i].cl>>stu[i].math>>stu[i].eng;
        stu[i].ave = (stu[i].cl + stu[i].math + stu[i].eng);
    }
    for(int i = 0; i < m; i ++){
        cin>>wc[i];
        int minnum = n + 1;
        int minclass = -1;
        sort(stu, stu + n, cmp4);
        for(int j = 0; j < n; j ++){
            if(stu[j].id == wc[i]){
                int tmp = 0;
                for(int k = j - 1; k >= 0; k --)
                    if(stu[j].ave == stu[k].ave)
                        tmp ++;
                    else 
                        break;
                if(j - tmp < minnum){
                    minnum = j - tmp;
                    minclass = 3;
                    break;
                }
            }
        }
        sort(stu, stu + n, cmp1);
        for(int j = 0; j < n; j ++){
            if(stu[j].id == wc[i]){
                int tmp = 0;
                for(int k = j - 1; k >= 0; k --)
                    if(stu[j].cl == stu[k].cl)
                        tmp ++;
                    else 
                        break;
                if(j - tmp < minnum){
                    minnum = j - tmp;
                    minclass = 0;
                    break;
                }
            }
        }
        sort(stu, stu + n, cmp2);
        for(int j = 0; j < n; j ++){
            if(stu[j].id == wc[i]){
                int tmp = 0;
                for(int k = j - 1; k >= 0; k --)
                    if(stu[j].math == stu[k].math)
                        tmp ++;
                    else 
                        break;
                if(j - tmp < minnum){
                    minnum = j - tmp;
                    minclass = 1;
                    break;
                }
            }
        }
        sort(stu, stu + n, cmp3);
        for(int j = 0; j < n; j ++){
            if(stu[j].id == wc[i]){
                int tmp = 0;
                for(int k = j - 1; k >= 0; k --)
                    if(stu[j].eng == stu[k].eng)
                        tmp ++;
                    else 
                        break;
                if(j - tmp < minnum){
                    minnum = j - tmp;
                    minclass = 2;
                    break;
                }
            }
        }
        if(minclass == -1){
            cout<<"N/A"<<endl;
            continue;
        }
        cout<<minnum + 1<<" "<<c[minclass]<<endl;
    }
    
}

已AC:最后一组规模超限(可以用一个哈希表存放学生学号和排名来优化,明天再写,今天有点晚了)

易失分点:
1.注意相同排名下不同科目的优先级
2.如果两人分数相同,他们的名称也应该相同,但是后一名应该是他们的名词+2,而不是+1.

标题SpringBoot基于Web的图书借阅管理信息系统设计与实现AI更换标题第1章引言介绍图书借阅管理信息系统的研究背景、意义、现状以及论文的研究方法和创新点。1.1研究背景与意义析当前图书借阅管理的需求和SpringBoot技术的应用背景。1.2国内外研究现状概述国内外在图书借阅管理信息系统方面的研究进展。1.3研究方法与创新点介绍本文采用的研究方法和系统设计的创新之处。第2章相关理论技术阐述SpringBoot框架、Web技术和数据库相关理论。2.1SpringBoot框架概述介绍SpringBoot框架的基本概念、特点和核心组件。2.2Web技术基础概述Web技术的发展历程、基本原理和关键技术。2.3数据库技术应用讨论数据库在图书借阅管理信息系统中的作用和选型依据。第3章系统需求析对图书借阅管理信息系统的功能需求、非功能需求进行详细析。3.1功能需求析列举系统应具备的各项功能,如用户登录、图书查询、借阅管理等。3.2非功能需求析阐述系统应满足的性能、安全性、易用性等方面的要求。第4章系统设计详细介绍图书借阅管理信息系统的设计方案和实现过程。4.1系统架构设计给出系统的整体架构,包括前后端离、数据库设计等关键部。4.2功能模块设计具体阐述各个功能模块的设计思路和实现方法,如用户管理模块、图书管理模块等。4.3数据库设计详细介绍数据库的设计过程,包括表结构、字段类型、索引等关键信息。第5章系统实现与测试对图书借阅管理信息系统进行编码实现,并进行详细的测试验证。5.1系统实现介绍系统的具体实现过程,包括关键代码片段、技术难点解决方法等。5.2系统测试给出系统的测试方案、测试用例和测试结果,验证系统的正确性和稳定性。第6章结论与展望总结本文的研究成果,指出存在的问题和未来的研究方向。6.1研究结论概括性地总结本文的研究内容和取得的成果。6.2展望对图书借阅管理
摘 要 基于SpringBoot的电影院售票系统为用户提供了便捷的在线购票体验,覆盖了从注册登录到观影后的评价反馈等各个环节。用户能够通过系统快速浏览和搜索电影信息,包括正在热映及即将上映的作品,并利用选座功能选择心仪的座位进行预订。系统支持多种支付方式如微信、支付宝以及银行卡支付,同时提供积兑换和优惠券领取等功能,增强了用户的购票体验。个人中心允许用户管理订单、收藏喜爱的影片以及查看和使用优惠券,极大地提升了使用的便利性和互动性。客服聊天功能则确保用户在遇到问题时可以即时获得帮助。 后台管理人员,系统同样提供了全面而细致的管理工具来维护日常运营。管理员可以通过后台首页直观地查看销售额统计图,了解票房情况并据此调整策略。电影信息管理模块支持新增、删除及修改电影资料,确保信息的准确与及时更新。用户管理功能使得管理员可以方便地处理用户账号,包括导入导出数据以供析。订单管理模块简化了对不同状态订单的处理流程,提高了工作效率。优惠券管理和弹窗提醒管理功能有助于策划促销活动,吸引更多观众。通过这样的集成化平台,SpringBoot的电影院售票系统不仅优化了用户的购票体验,也加强了影院内部的管理能力,促进了业务的发展和服务质量的提升。 关键词:电影院售票系统;SpringBoot框架;Java技术
内容概要:本文介绍了2025年中国网络安全的十大创新方向,涵盖可信数据空间、AI赋能数据安全、ADR(应用检测与响应)、供应链安全、深度伪造检测、大模型安全评估、合规管理与安全运营深度融合、AI应用防火墙、安全运营智能体、安全威胁检测智能体等。每个创新方向不仅提供了推荐的落地方案和典型厂商,还详细阐述了其核心能力、应用场景、关键挑战及其用户价值。文中特别强调了AI技术在网络安全领域的广泛应用,如AI赋能数据安全、智能体驱动的安全运营等,旨在应对日益复杂的网络威胁,提升企业和政府机构的安全防护能力。 适合人群:从事网络安全、信息技术、数据管理等相关工作的专业人士,尤其是负责企业信息安全、技术架构设计、合规管理的中高层管理人员和技术人员。 使用场景及目标:①帮助企业理解和应对最新的网络安全威胁和技术趋势;②指导企业选择合适的网络安全产品和服务,提升整体安全防护水平;③协助企业构建和完善自身的网络安全管理体系,确保合规运营;④为技术研发人员提供参考,推动技术创新和发展。 其他说明:文章内容详尽,涉及多个技术领域和应用场景,建议读者根据自身需求重点关注相关章节,并结合实际情况进行深入研究和实践。文中提到的多个技术和解决方案已在实际应用中得到了验证,具有较高的参考价值。此外,随着技术的不断发展,文中提及的部技术和方案可能会有所更新或改进,因此建议读者保持关注最新的行业动态和技术进展。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值