文章
3
粉丝
175
获赞
3
访问
14.8k
#include<iostream>
#include<algorithm>
using namespace std;
struct Student{
int year, month, day, grade;
}stu[105];
bool cmp(Student a, Student b){
if(a.grade != b.grade) return a.grade > b.grade;
else if(a.year != b.year) return a.year < b.year;
else if(a.month != b.month) return a.month < b.month;
else return a.day < b.day;
}
int main(){
int n;
while(cin >> n){
for(int i = 0; i < n; ++i){
scanf("%d/%d/%d", &stu[i].year, &stu[i].month, &stu[i].day);
cin >> stu[i].grade;
}
sort(stu, stu+n, cmp);
for(...
登录后发布评论
暂无评论,来抢沙发