## 12541 - Birthdates

All about problems in Volume 125. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

### 12541 - Birthdates

Here's some input / output I found useful during testing / debugging.

Input:

Code: Select all

``````10
Machel 31 12 4999
Amar 27 9 1991
Conrad 1 1 1999
Kara 18 9 5001
Tom 29 1 1991
Priyanka 1 12 5001
Melissa 25 10 1991
Ping 16 10 5001
Amidala 10 1 1991
Xena 17 10 5001``````
AC Output:

Code: Select all

``````Priyanka
Amidala
``````
Check input and AC output for over 7,500 problems on uDebug!

battirunner
New poster
Posts: 14
Joined: Fri Aug 15, 2014 3:48 pm

### Re: 12541 - Birthdates

Code: Select all

``````why WA ?
#include<stdio.h>
#include<string.h>
int main()
{
int test,d,m,y,day,mn,mx,t;
char name[20],older[20],younger[20];
scanf("%d",&test);
t=test;
while(test--)
{
scanf("%s",name);

scanf("%d%d%d",&d,&m,&y);
day=d+(31*m)+(y*12*31);
if(test==t-1)
{
mn=day;
mx=day;
strcpy(older,name);
strcpy(younger,name);
}
if(day<mx)
{
strcpy(older,name);
mx=day;
}
else if(day>mn)
{
strcpy(younger,name);
mn=day;
}
}
printf("%s\n%s",younger,older);
return 0;
}
:(
``````

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 12541 - Birthdates

Always print a newline char at the end of the last line.
Check input and AC output for thousands of problems on uDebug!

battirunner
New poster
Posts: 14
Joined: Fri Aug 15, 2014 3:48 pm

### Re: 12541 - Birthdates

battirunner wrote:

Code: Select all

``````Thanks brainfry
``````