12802 - Gift From the Gods

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

Moderator: Board moderators

Post Reply
MPC1984
New poster
Posts: 40
Joined: Mon Jul 01, 2013 9:24 pm
Location: Valladolid, Spain

12802 - Gift From the Gods

Post by MPC1984 » Fri Oct 10, 2014 10:48 am

Hi everybody!!!
I'm getting RTE in this problem, and I don't know why. Somebody could help me?

Here is my code in Java:

Code: Select all

AC
Thanks in advance. :wink:
Last edited by MPC1984 on Tue Oct 14, 2014 12:30 pm, edited 1 time in total.

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

Re: 12802 - Gift From the Gods

Post by brianfry713 » Sat Oct 11, 2014 2:27 am

At the end of the input you're getting a java.lang.NullPointerException by calling trim() on a null String.
Check input and AC output for thousands of problems on uDebug!

MPC1984
New poster
Posts: 40
Joined: Mon Jul 01, 2013 9:24 pm
Location: Valladolid, Spain

Re: 12802 - Gift From the Gods

Post by MPC1984 » Sat Oct 11, 2014 11:51 am

Hi brianfry713!
I have done changes you said me, but now I'm getting WA, what's wrong?

Code: Select all

AC
Thanks in advance again. :wink:
Last edited by MPC1984 on Tue Oct 14, 2014 12:31 pm, edited 1 time in total.

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

Re: 12802 - Gift From the Gods

Post by brianfry713 » Mon Oct 13, 2014 10:54 pm

You have to stop the output when the input is a palindrome prime number (after outputting its double also).

You are comparing a StringBuilder to a String, which will always return false.
Check input and AC output for thousands of problems on uDebug!

MPC1984
New poster
Posts: 40
Joined: Mon Jul 01, 2013 9:24 pm
Location: Valladolid, Spain

Re: 12802 - Gift From the Gods

Post by MPC1984 » Tue Oct 14, 2014 12:32 pm

Thank you brianfry713!!! I got AC.
A very silly mistake comparing a String and a StringBuilder. :D

Post Reply

Return to “Volume 128 (12800-12899)”