11219 - How old are you?

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

Moderator: Board moderators

jahideu
New poster
Posts: 6
Joined: Thu Feb 22, 2007 9:16 am
Location: Eastern University, Dhaka

Post by jahideu » Tue Jun 12, 2007 6:39 am

I need some more I/O. Please help me.

h_davary
New poster
Posts: 4
Joined: Tue May 15, 2007 8:29 am

Post by h_davary » Tue Jun 12, 2007 8:35 pm

I need too :lol:
plz, anybody can make some?
I got WA....
thanx
----------
Got AC
Thanks all :)
Last edited by h_davary on Sun Jun 17, 2007 10:17 pm, edited 1 time in total.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan » Tue Jun 12, 2007 10:29 pm

Try the cases.

Input:

Code: Select all

7

29/02/2008
29/02/2000

28/02/2008
29/02/2000

01/03/2008
29/02/2000

01/03/2001
29/02/2000

28/02/2001
29/02/2000

29/02/2000
29/02/2000

29/02/2000
28/02/2000
Output:

Code: Select all

Case #1: 8
Case #2: 7
Case #3: 8
Case #4: 1
Case #5: 0
Case #6: 0
Case #7: 0
Hope these help.
Ami ekhono shopno dekhi...
HomePage

jahideu
New poster
Posts: 6
Joined: Thu Feb 22, 2007 9:16 am
Location: Eastern University, Dhaka

Post by jahideu » Wed Jun 13, 2007 8:41 am

Still i get WA.
I am going to be maddddddddddd.
please give me more input output.
please.....

User avatar
rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Post by rio » Wed Jun 13, 2007 9:50 am

I think all tricky cases has been posted.
Once again be sure that your output format is right. (spellmiss... etc).
----
Rio

jahideu
New poster
Posts: 6
Joined: Thu Feb 22, 2007 9:16 am
Location: Eastern University, Dhaka

Post by jahideu » Wed Jun 13, 2007 10:38 am

Can any one chack my code.
why WA many times?

AC. thanks to all.
Last edited by jahideu on Thu Jun 14, 2007 11:04 am, edited 1 time in total.

User avatar
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel » Wed Jun 13, 2007 11:29 am

Did you get the sample in/out right?

Check the 2nd test case ::

09/06/2007
28/02/1871


The output should be "Case #2: Check birth date" !!

Please make sure the sample in/out matches before posting your code.

User avatar
Jemerson
Learning poster
Posts: 59
Joined: Mon Feb 02, 2004 11:19 pm
Contact:

Post by Jemerson » Mon Jun 18, 2007 8:48 pm

One more case that all tests above didn't cover and which was breaking my code follows:

Input:

Code: Select all

1

05/06/2031
06/06/1900
Output:

Code: Select all

Case #1: 130
UFCG Brazil - Computer Science graduate student
http://acm.uva.es/problemset/usersnew.php?user=54806 ... and going up!

sakhassan
Experienced poster
Posts: 105
Joined: Sat Mar 11, 2006 9:42 am
Location: cse,DU

getting WA

Post by sakhassan » Fri Jun 22, 2007 4:17 pm

I am getting WA .. I tried all inputs in the forum :(

Code: Select all


Deleted after AC
Thanks in advanced
Time that gone is gone forever ...

Parleen
New poster
Posts: 5
Joined: Wed Jun 20, 2007 8:27 pm
Location: DreamTown

Post by Parleen » Sun Jun 24, 2007 7:14 pm

Plz tell me whats wrong in my code, it gives correct answer for all the i/o above..... :o

Code: Select all

#include<stdio.h>
#include<math.h>

void main()
{
long d,m,y,d1,m1,y1,d2,m2,y2,a,b,c,i,j,k,test,t;
char cy,cur[12],bir[12],ch,c1,c2,c3;

scanf("%ld",&test);

ch=getchar();
for(t=1;t<=test;t++)
{

cy=getchar();
gets(cur);
gets(bir);

sscanf(cur,"%ld%c%ld%c%ld",&d1,&c1,&m1,&c2,&y1);
sscanf(bir,"%ld%c%ld%c%ld",&d2,&c1,&m2,&c2,&y2);

y=y1-y2;
m=m1-m2;
d=d1-d2;
printf("Case #%ld: ",t);
if(y<0 ||(y==0 && m<0)||(y==0 && m==0 && d<0))
printf("Invalid birth date\n");
else if(y==0 && m>=0 && d>=0)
printf("0\n");

else if(y>0)
{
  if(m>0 ||(m==0 && d>=0))
  {
    if(y>130)
     printf("Check birth date\n");
     else
     printf("%ld\n",y);
  }

  else if(m<0 ||(m==0 && d<0))
  {  y--;
    if(y>130)
     printf("Check birth date\n");
     else
     printf("%ld\n",y);

  }
else
printf("0\n");
}
}
}
Somebody help me

User avatar
rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan

Post by rio » Mon Jun 25, 2007 6:11 am

Try this test case

Code: Select all

1

01/02/1984
02/01/1984
----
Rio

shakil
Learning poster
Posts: 74
Joined: Sat Jul 15, 2006 6:28 am
Location: CUET , bangladesh
Contact:

Post by shakil » Tue Jun 26, 2007 8:51 am

i am WA.But Why? Please help me???

Code: Select all

Cut after AC
Last edited by shakil on Fri Jul 06, 2007 9:27 pm, edited 1 time in total.
SHAKIL

User avatar
Rocky
Experienced poster
Posts: 124
Joined: Thu Oct 14, 2004 9:05 am
Contact:

Post by Rocky » Fri Jul 06, 2007 6:29 pm

to shakil :
check the following io

Code: Select all


12/12/2004
12/12/2003

GOOD LUCK
Rocky

shakil
Learning poster
Posts: 74
Joined: Sat Jul 15, 2006 6:28 am
Location: CUET , bangladesh
Contact:

Post by shakil » Fri Jul 06, 2007 9:25 pm

Thanks rockey........ :wink:
SHAKIL

Pedro
New poster
Posts: 5
Joined: Fri Jul 20, 2007 5:18 pm

Post by Pedro » Fri Jul 20, 2007 5:43 pm

I tried all the inputs given and the outputs are correctly, but I got WA
I don't know where my code is wrong. Any idea?

Code: Select all

void CalculaAnos(int d1,int d2,int m1,int m2,int a1,int a2,int numCaso){
     int m,a,d;
    if (a1==a2){
       if (m1>=m2){
          if (m2==m1){
             if (d1>=d2){
                   printf("Case #%d: 0",numCaso); 
                   return;          
             }else{
                   printf("Case #%d: Invalid birth date",numCaso); 
                   return;
                   }         
          }else{
                printf("Case #%d: 0",numCaso); 
                return;
                }
       }else{
             printf("Case #%d: Invalid birth date",numCaso); 
             return;
             }            
    }else{
          if (a1<a2){
             printf("Case #%d: Invalid birth date",numCaso); 
             return;      
          }else{
                if (m1>m2){
                   a=a1-a2;        
                }else{
                      if (m1==m2){
                         if (VerificaBissexto(a2)==1){
                           if (VerificaBissexto(a1)==0){
                            if ((d2==29)&&(d1==28)){
                               printf("Case #%d: 0",numCaso); 
                               return;                     
                            } 
                           }else{
                                 if (d1<d2){
                                    a=a1-a2-1; 
                                    printf("Case #%d: %d",numCaso,a);
                                    return;          
                                 }
                                 }                        
                         } 
                           if (m2>m1){
                              a=a1-a2-1; 
                              printf("Case #%d: %d",numCaso,a);
                              return;          
                           }        
                                   if (d2<d1){
                                      a=a1-a2;       
                                   }else{
                                         if (d2!=d1){
                                            a=a1-a2-1;
                                         }else{
                                               a=a1-a2;
                                         }
                                   } 
                      }
                      }
                }
          }
  if (a<=130){        
    printf("Case #%d: %d",numCaso,a);
    }else{
          printf("Case #%d: Check birth date",numCaso,a);
          }
}

Post Reply

Return to “Volume 112 (11200-11299)”