10260 - Soundex

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

Moderator: Board moderators

mamun
A great helper
Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm
Location: Bangladesh
Contact:

Post by mamun » Mon Dec 05, 2005 3:42 pm

A very simple mistake. I'll let you find where it is.
Input

Code: Select all

SAD
DOG
Output

Code: Select all

23
32

Timo
Learning poster
Posts: 70
Joined: Tue Oct 11, 2005 2:44 am
Location: Indonesia

Post by Timo » Mon Dec 05, 2005 3:47 pm

try this input

Code: Select all

input

RAAR
RAMA

output

66
65
I hope you can get AC.
:D
"Life is more beautiful with algorithm"

abhi
Learning poster
Posts: 94
Joined: Fri Nov 25, 2005 7:29 pm

Post by abhi » Mon Dec 05, 2005 4:05 pm

thanks a lot to both of you . i got AC..........
but the time was 0.002s how can i make it faster ??? :wink:

Timo
Learning poster
Posts: 70
Joined: Tue Oct 11, 2005 2:44 am
Location: Indonesia

Post by Timo » Tue Dec 06, 2005 2:40 am

congratulations for you AC.

you can use gets() to read the data for improve your program speed.

:D
"Life is more beautiful with algorithm"

MasterHunter
New poster
Posts: 2
Joined: Sun Mar 22, 2009 4:49 pm

Re: 10260 - Soundex

Post by MasterHunter » Sun Mar 22, 2009 4:55 pm

I tried the input mentioned above and got the correct output... My code:

Code: Select all

Accepted
Can anybody help me? I got WA =/
Last edited by MasterHunter on Sun Mar 22, 2009 5:55 pm, edited 1 time in total.

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Re: 10260 - Soundex

Post by helloneo » Sun Mar 22, 2009 5:46 pm

MasterHunter wrote:I tried the input mentioned above and got the correct output... My code:

Can anybody help me? I got WA =/
I'm not sure whether printing '\0' is ok..
I'll do it like this..

Code: Select all

if (next_char != '\0')
    printf("%c", next_char);

MasterHunter
New poster
Posts: 2
Joined: Sun Mar 22, 2009 4:49 pm

Re: 10260 - Soundex

Post by MasterHunter » Sun Mar 22, 2009 5:55 pm

OMG
Thanks a LOT, man :D
Got AC

User avatar
plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

Re: 10260 - Soundex

Post by plamplam » Sun Jun 12, 2011 10:06 pm

I think this is the most common mistake that everyone makes, let S be the soundex number that you are calculating. Now, if only the string "A"(or other characters or combination of characters for which no soundex exists) is given as input, DO NOT print 0. But if you don't print anything then you get Wrong Answer too :wink: . So what you need to do is just print a blank line.
So the bottomline is, your code needs to have the following part:
if (s != 0){printf("%llu\n", s);}
else {printf("\n");}
(I got Wrong Answers 3 times just because of the newline :x )

And one more thing, consider this case RMRNRMRNRMRNRNRNRMR, the soundex value here exceeds 2^31 even 2^32 - 1, so use long long or unsigned long long. I got AC with unsigned long long. Hope this helps, best of luck. Happy coding
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

bgcsaif
New poster
Posts: 38
Joined: Mon Sep 29, 2014 4:03 pm

Re: 10260 - Soundex

Post by bgcsaif » Wed Oct 01, 2014 9:56 am

My code gives me right output I assume. But WA. I need help.

http://ideone.com/QTQ7wQ

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

Re: 10260 - Soundex

Post by brianfry713 » Wed Oct 01, 2014 11:42 pm

Try input B
Check input and AC output for thousands of problems on uDebug!

bgcsaif
New poster
Posts: 38
Joined: Mon Sep 29, 2014 4:03 pm

Re: 10260 - Soundex

Post by bgcsaif » Thu Oct 02, 2014 8:16 am

Here is my codes after correction. But it's still WA. . . . .http://ideone.com/dUXOhL :(

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 10260 - Soundex

Post by lighted » Thu Oct 02, 2014 1:36 pm

Input

Code: Select all

LR
Acc Output

Code: Select all

46
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

bgcsaif
New poster
Posts: 38
Joined: Mon Sep 29, 2014 4:03 pm

Re: 10260 - Soundex

Post by bgcsaif » Thu Oct 02, 2014 4:09 pm


lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 10260 - Soundex

Post by lighted » Thu Oct 02, 2014 4:21 pm

Try input A
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

bgcsaif
New poster
Posts: 38
Joined: Mon Sep 29, 2014 4:03 pm

Re: 10260 - Soundex

Post by bgcsaif » Fri Oct 03, 2014 11:21 am

Oops! I forgot to check that single positioned default number. Thank you sir! I got Accepted afterall. . . . . :)

Post Reply

Return to “Volume 102 (10200-10299)”