-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1028.cpp
More file actions
61 lines (53 loc) · 916 Bytes
/
1028.cpp
File metadata and controls
61 lines (53 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
struct inf{
string name;
int date;
int y;
int m;
int d;
};
bool cmp(inf a, inf b){ return a.date > b.date; }
int main(){
int n;
cin >> n;
inf *a= new inf[n];
string s;
string num;
int i = 0;
for ( i = 0; i < n; i++){
cin >> a[i].name;
scanf_s("%d/%d/%d", &a[i].y, &a[i].m, &a[i].d);
a[i].date = a[i].y * 10000 + a[i].m * 100+ a[i].d;
if (a[i].date>20140906 || a[i].date < 18140906){
n--;
i--;
continue;
}
/*for (int j = 0; j < s.size(); j++){
if (s[j] != '/'){
num.push_back(s[j]);
}
}
if (stoi(num)>20140906 || stoi(num) < 18140906){
n--;
i--;
num.clear();
continue;
}
else{
a[i].date = stoi(num);
}
num.clear();
*/
}
sort(a, a + i,cmp);
if (i == 0)
cout << 0;
else
cout << n <<" "<< a[i-1].name <<" "<< a[0].name;
system("pause");
return 0;
}