problem 484 WA plz help

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

Moderator: Board moderators

problem 484 WA plz help

Postby georgemouse » Tue Jan 31, 2006 3:46 pm

I have tried all the possible input and all are right.
But I still got WA.
Can someone tell me what is wrong??
Thanks!!!

Code: Select all
//acm484
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
   char *p,in[100000];
   int find,c,n,t=0,times[100000][2];
   for(n=0;n<100000;n++)   times[n][1]=1;
   gets(in);
   p=strtok(in," ");
   times[t++][0]=atoi(p);
   while((p=strtok(NULL," "))!=0)
   {
      for(n=c=0;n<t;n++)
         if(times[n][0]==atoi(p))
         {
            c=1;
            find=n;
            break;
         }
      if(c!=0)   times[find][1]++;
      else   times[t++][0]=atoi(p);
   }
   for(n=0;n<t;n++)   printf("%d %d\n",times[n][0],times[n][1]);
   return 0;
}
georgemouse
New poster
 
Posts: 13
Joined: Sun Aug 28, 2005 3:39 pm
Location: Taiwan

Postby Wei-Ming Chen » Tue Jan 31, 2006 5:32 pm

I didn't think this problem should use %c, I used %d to scanf and got AC.
What made your code wrong maybe is something wrong when you changed char to int.
Or the input is look like

6 5 6
4 5
3
3
Wei-Ming Chen
Experienced poster
 
Posts: 122
Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan

Postby georgemouse » Fri Feb 03, 2006 9:48 am

Thank you ,Wei-Ming Chen!!!
I've misunderstood the problem.
Now I have accepted.
Thank you very much!!!!

Best regards,
georgemouse
New poster
 
Posts: 13
Joined: Sun Aug 28, 2005 3:39 pm
Location: Taiwan

problem 484 WA help

Postby calicratis19 » Mon Oct 13, 2008 9:02 pm

can anyone give me some i/o.im having wa in it. :(
Code: Select all
deleted......AC
Last edited by calicratis19 on Tue Feb 10, 2009 4:10 pm, edited 1 time in total.
Heal The World
calicratis19
Learning poster
 
Posts: 76
Joined: Mon Jul 21, 2008 8:50 am
Location: SUST,SYLHET,BANGLADESH.

Re: problem 484 WA plz help

Postby lnr » Fri Oct 17, 2008 8:24 pm

To calicratis19.
Try this.
Input:
Code: Select all
9 5 1 -1 -8 -6 0 34 -12

Output:
Code: Select all
9 1
5 1
1 1
-1 1
-8 1
-6 1
0 1
34 1
-12 1
User avatar
lnr
Experienced poster
 
Posts: 134
Joined: Sat Jun 30, 2007 2:52 pm
Location: (DU,CSE)Dhaka,Bangladesh

Re: problem 484 WA plz help

Postby calicratis19 » Fri Oct 24, 2008 8:52 am

thanks :)
AC :lol:
Heal The World
calicratis19
Learning poster
 
Posts: 76
Joined: Mon Jul 21, 2008 8:50 am
Location: SUST,SYLHET,BANGLADESH.


Return to Volume IV

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron