-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpat1028.c
More file actions
38 lines (31 loc) · 815 Bytes
/
Copy pathpat1028.c
File metadata and controls
38 lines (31 loc) · 815 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
#include<stdio.h>
#include<string.h>
int main(){
int n;
int year,month,day;
int count = 0;
char name[6], max_name[6], min_name[6];
long long maxAge = 20140907, minAge = 18140905;
scanf("%d",&n);
for(int i = 0; i < n; i++){
scanf("%s %d/%d/%d",&name,&year,&month,&day);
long long birth = year*10000+month*100+day;
if(birth < 18140906 || birth > 20140906);
else{
count++;
if(birth < maxAge){
strcpy(max_name,name);
maxAge = birth;
}
if(birth > minAge){
strcpy(min_name,name);
minAge = birth;
}
}
}
if(count)
printf("%d %s %s\n",count,max_name,min_name);
else
printf("0\n");
return 0;
}