10848 - Make Palindrome Checker

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

Moderator: Board moderators

L I M O N
Learning poster
Posts: 58
Joined: Wed Dec 31, 2003 8:43 am
Location: Dhaka, Bangladesh
Contact:

10848 - Make Palindrome Checker

Post by L I M O N »

pls anyone hlep me about this problem.
i think this is an easy problem, but getting WA again and again. what's the tric ??
pls HELP ME.

L I M O N
QulinXao
New poster
Posts: 29
Joined: Mon Apr 05, 2004 11:12 am

Post by QulinXao »

All simple
u MUST very cerefull
u must right test p1
0<length(s1)<1001 0<=n<... etc
Sanny
Learning poster
Posts: 78
Joined: Sat Feb 14, 2004 3:59 pm
Location: BUET
Contact:

Post by Sanny »

Check if there is more than one space between inputs. I gave a check like this -

Code: Select all

if (length of 1st string + length of 2nd string + length of number + 2 != length of input line)
return false
Regards
Sanny
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

More than one space between input fields was easy to notice. What I missed in my few first submissions was that a space could occur after the second string. Fixing that gave me AC.
..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong

Post by .. »

I think the problem statement is so clearly written, as it doesn't give insturction to reject trailing space after second instruction. If there are no words asking me to reject it, I assume it should be accepted.

Also, it is not clear what we should do if the length of string is zero.(In my AC program, I give T for P1)
My signature:
  • Please make discussion about the algorithm BRFORE posting source code.
    We can learn much more in discussion than reading source code.
  • I HATE testing account.
  • Don't send me source code for debug.
dumb dan
Learning poster
Posts: 67
Joined: Tue Aug 05, 2003 1:02 am

Post by dumb dan »

> Also, it is not clear what we should do if the length of string is zero.(In my AC program, I give T for P1)

Giving T for P1 seems like the right thing to do, but I can also note that my AC program gives F for P1 when the second string is of zero length. So there cannot be any such inputs.
L I M O N
Learning poster
Posts: 58
Joined: Wed Dec 31, 2003 8:43 am
Location: Dhaka, Bangladesh
Contact:

Post by L I M O N »

Sanny wrote:Check if there is more than one space between inputs. I gave a check like this -

Code: Select all

if (length of 1st string + length of 2nd string + length of number + 2 != length of input line)
return false
Regards
Sanny
thanks Sanny, that was my problem. i just got AC now.
neno_uci
Experienced poster
Posts: 104
Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba

Post by neno_uci »

Hi:

I think I've checked everything but that's obviously not true due to my WA :(, could you see my code and tell me what is wrong?

Code: Select all

Cut after AC
Thanx in advance,

Yandry. :oops:
Last edited by neno_uci on Thu May 12, 2005 2:04 pm, edited 1 time in total.
mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf »

Consider the test case: " 0 " (a space, a zero, a space, a newline). My output: "TTTTTTF The solution is not accepted"

Also, the property #5 can be checked with a greedy O(n+m) algorithm.
neno_uci
Experienced poster
Posts: 104
Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba

Post by neno_uci »

Could anybody give me some hard input cases?, I've solved the problem that mf told me...
[_TANG_]
New poster
Posts: 15
Joined: Wed May 04, 2005 12:28 am
Location: Mexico

Question

Post by [_TANG_] »

If P1 is false, then all the next conditions are false too?

I can't get AC ... :cry: ... I've fix all bugs I thought and my code crash all the time.

Can anyone help me?

thnx
____________
[_TANG_]
neno_uci
Experienced poster
Posts: 104
Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba

Post by neno_uci »

You are right TANG, please some test cases..., this is driving me maaaaaaaaaaaaaaddddd :oops:
mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf »

I checked your code. Firstly, don't use scanf() for parsing the input (you said you had fixed that). Secondly, the line

Code: Select all

if (n1 > 1000 || n2 > 2000) return 0;
should read:

Code: Select all

if (n1 > 1000 || n3 > 2000 || n2 == 0) return 0;
I've been able to make your code above accepted. If you want, I'll send you the changes I made.
neno_uci
Experienced poster
Posts: 104
Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba

Post by neno_uci »

Thanx a lot mf!!!, I solved it with that last hint :D , you are a great helper :wink:
[_TANG_]
New poster
Posts: 15
Joined: Wed May 04, 2005 12:28 am
Location: Mexico

Post by [_TANG_] »

if the 2
Last edited by [_TANG_] on Thu May 12, 2005 5:16 pm, edited 2 times in total.
Post Reply

Return to “Volume 108 (10800-10899)”