## 290 PalindromssmordnilaP

Moderator: Board moderators

I am confused for the base in 290.
In the Example:
Base 8 87+78=207
But how can digit 8 appear in the number based 8. I think 8 is illegal here.

Could anyone tell me what's wrong?
yatsen
Learning poster

Posts: 68
Joined: Fri Nov 23, 2001 2:00 am
Location: taiwan

i'm not sure which one you're referring to. the version on the web site states 'illegal' already

but, i can't get AC either.
can anyone tell me what tricks it has?

1. need to trim leading zeros first?
2. is there 0 steps?
3. what other tricks it has?
4. if input 0, then all zeros?
wyvmak
Experienced poster

Posts: 110
Joined: Thu Dec 13, 2001 2:00 am

Hmm..
Check this out:
Sample Example is wrong:
857 + 758 = 1726
1762 + 2671 = 7543

Why does 1726-->1762?
gilbert
New poster

Posts: 4
Joined: Wed Dec 12, 2001 2:00 am

1. need to trim leading zeros first?
No (I don't).

2. is there 0 steps?
Yes.

3. what other tricks it has?
None. Maybe the input is badly formatted? I read it with scanf("%s").

4. if input 0, then all zeros?
Yes.

"1726-->1762" is obviously a mistake. Ignore it.

Good luck,
Stefan
pochmann
New poster

Posts: 28
Joined: Sat Jan 26, 2002 2:00 am

Check to see if the string is valid for each of the different bases.
C8H10N4O2
Experienced poster

Posts: 137
Joined: Wed Feb 27, 2002 2:00 am

The example is totally messed up!

Base 15 87 + 78 = 110
110 + 011 = 121 2 steps
Base 14 87 + 78 = 111 1 step <-- it should be "121 1 step"
Base 13 87 + 78 = 132
132 + 231 = 363 2 steps
Base 12 87 + 78 = 143
143 + 341 = 484 2 steps
Base 11 87 + 78 = 154
154 + 451 = 5A5 2 steps
Base 10 87 + 78 = 165
165 + 561 = 726
726 + 627 = 1353
1353 + 3531 = 4884 4 steps
Base 9 87 + 78 = 176
176 + 671 = 857
857 + 758 = 1726
1762 + 2671 = 7543 <-- it should be "1726 + 6271 = 8107"
7543 + 3457 = 12111 <-- it should be "8107 + 7018 = 16126"
12111 + 11121 = 23232 6 steps <-- it should be "16126 + 62161 = 78287 6 steps"
Base 8 87 + 78 = 207 <-- in base 8 digits go from 0 to 7, 87 is illegal!
207 + 702 = 1111 2 steps <-- therefore, this line shouldn't be here
Base 7 illegal ? steps
Base 6 illegal ? steps
Base 5 illegal ? steps
Base 4 illegal ? steps
Base 3 illegal ? steps
Base 2 illegal ? steps

Which means, the correct output for 87 is not:

2 1 2 2 2 4 6 2 ? ? ? ? ? ?

like shown in the sample output; it is:

2 1 2 2 2 4 6 ? ? ? ? ? ? ?

Which is almost the same, but the intermediate results are completely wrong.