文章
24
粉丝
0
获赞
180
访问
4.1k
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
struct G {
int year;
int month;
int day;
int grade;
};
bool des_grade(G g1, G g2) {
return g1.grade > g2.grade;
}
bool asc_day(G g1, G g2) {
return g1.day < g2.day;
}
bool asc_month(G g1, G g2) {
return g1.month < g2.month;
}
bool asc_year(G g1, G g2) {
return g1.year < g2.year;
}
int main() {
int n;
while(cin >> n) {
vector<G> v(n);
for(int i = 0; i < n; i++)
scanf("%d/%d/%d %d",&v[i].year,&v[i].month,&v[i].day,&v[i].grade);
stable_sort(v.begin(),v.end(),asc_day);
stable_sort(v.begin(),v.end(),asc_month);
stable_sort(v.begin(),v.end(),asc_year);
stable_sort(v.begin(),v.end(),des_grade);
for(auto ele : v)
printf("%...
登录后发布评论
暂无评论,来抢沙发