PTA甲级1012 排序算法
题目:
大意:每个学生有三个科目的成绩和一个平均分,找出每个学生最好的排名,如果有相同的分数按照a>c>m>e的顺序给出。
代码
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
struct student{
int id;
int grade[4];//存放4个成绩
}stu[2000];
char course[4] = {
'A','C','M','E'};
int Rank[1000000][4]={
0};//对应排名
int now;//按now号分数排序stu数组