## 10848 - Make Palindrome Checker

Moderator: Board moderators

### 10848 - Make Palindrome Checker

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
L I M O N
Learning poster

Posts: 58
Joined: Wed Dec 31, 2003 8:43 am

All simple
u MUST very cerefull
u must right test p1
0<length(s1)<1001 0<=n<... etc
QulinXao
New poster

Posts: 29
Joined: Mon Apr 05, 2004 11:12 am

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
Sanny
Learning poster

Posts: 78
Joined: Sat Feb 14, 2004 3:59 pm
Location: BUET

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.

Krzysztof Duleba
Guru

Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland

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:
We can learn much more in discussion than reading source code.
• I HATE testing account.
• Don't send me source code for debug.
..
A great helper

Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong

> 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.

dumb dan
Learning poster

Posts: 67
Joined: Tue Aug 05, 2003 1:02 am

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.
L I M O N
Learning poster

Posts: 58
Joined: Wed Dec 31, 2003 8:43 am

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`

Yandry.
Last edited by neno_uci on Thu May 12, 2005 2:04 pm, edited 1 time in total.
neno_uci
Experienced poster

Posts: 104
Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba

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.
mf
Guru

Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland

Could anybody give me some hard input cases?, I've solved the problem that mf told me...
neno_uci
Experienced poster

Posts: 104
Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba

### Question

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

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

Can anyone help me?

thnx
____________
[_TANG_]

[_TANG_]
New poster

Posts: 15
Joined: Wed May 04, 2005 12:28 am
Location: Mexico

You are right TANG, please some test cases..., this is driving me maaaaaaaaaaaaaaddddd
neno_uci
Experienced poster

Posts: 104
Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba

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;`

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.
mf
Guru

Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland

Thanx a lot mf!!!, I solved it with that last hint , you are a great helper
neno_uci
Experienced poster

Posts: 104
Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba

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

[_TANG_]
New poster

Posts: 15
Joined: Wed May 04, 2005 12:28 am
Location: Mexico

Next