1 solutions
-
0
#include <bits/stdc++.h> using namespace std; struct people{ string id; string a; int year; int yue; int day; }pp[100005]; bool cmp(people x , people y){ if(x.year == y.year){ if(x.yue == y.yue){ if(x.day == y.day){ return x.id >y.id; } return x.day > y.day; } return x.yue > y.yue; }else{ return x.year > y.year; } } int main() { long long n; cin >> n; getchar(); for(long long i = 1 ;i <= n ;i++){ getline(cin,pp[i].a); pp[i].id = pp[i].a; string year = (pp[i].a).substr(6,4); pp[i].year = stoi(year); string yue = (pp[i].a).substr(10,2); pp[i].yue = stoi(yue); string day = (pp[i].a).substr(12,2); pp[i].day = stoi(day); } sort(pp + 1 ,pp + 1 + n , cmp); for(long long i = 1 ;i <= n ;i++){ cout << pp[i].a << "\n"; } return 0; }
- 1
Information
- ID
- 1633
- Time
- 1000ms
- Memory
- 512MiB
- Difficulty
- 10
- Tags
- # Submissions
- 6
- Accepted
- 1
- Uploaded By