PATA1137题解

本文详细解读PAT考试中PATA1137题目,重点探讨该题目的解决方案,主要涉及排序算法的应用。
摘要由CSDN通过智能技术生成

排序题

//
//  main.cpp
//  PATA1137
//
//  Created by Phoenix on 2018/2/26.
//  Copyright © 2018年 Phoenix. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
const int maxn = 30010;

struct node {
    string id;
    int program;
    int Gm, Gf;
    int grade;
    int flag;
}stu[maxn];

bool cmp(node a, node b) {
    if(a.grade != b.grade) return a.grade > b.grade;
    else return a.id < b.id;
}

map<string, int> mp;
int main(int argc, const char * argv[]) {
    int p, m, n;
    scanf("%d %d %d", &p, &m, &n);
    for(int i = 0; i < p + m + n; i++) {
        stu[i].program = 0;
        stu[i].Gm = stu[i].Gf = -1;
        stu[i].grade = 0;
        stu[i].flag = 0;
    }
    int num = 0;
    for(int i = 0; i < p; i++) {
        s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值