10420 WA

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

Moderator: Board moderators

10420 WA

Postby rambo1980 » Sun Mar 18, 2012 2:52 pm

Please help me out with this code. I've tried several testcases by myself and my code seems to work perfectly, yet i got WA. Here is the code-
Code: Select all
AC
Last edited by rambo1980 on Fri Apr 06, 2012 3:07 pm, edited 1 time in total.
rambo1980
New poster
 
Posts: 15
Joined: Sun Mar 18, 2012 2:45 pm

Re: 10420 WA

Postby brianfry713 » Mon Mar 19, 2012 11:02 pm

Change this line:
if(strcmp(countries[i],countries[j])==1)
to:
if(strcmp(countries[i],countries[j])>0)
brianfry713
Guru
 
Posts: 1771
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10420 WA

Postby rambo1980 » Tue Mar 20, 2012 10:23 am

wow, it worked! but i'm confused here, i though strcmp(char* ,char* ) was supposed to return any one of -1,0,1 and no other value! i've tested this in codeblocks for several strings! why is the function acting differently now? :\
rambo1980
New poster
 
Posts: 15
Joined: Sun Mar 18, 2012 2:45 pm

Re: 10420 WA

Postby brianfry713 » Tue Mar 20, 2012 9:26 pm

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

Re: 10420 WA

Postby rambo1980 » Tue Mar 27, 2012 11:29 am

thanks
rambo1980
New poster
 
Posts: 15
Joined: Sun Mar 18, 2012 2:45 pm


Return to Volume X

Who is online

Users browsing this forum: No registered users and 1 guest