시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 47 | 17 | 12 | 35.294% |
A palindrome is an integer which reads the same backward as forward. For example, numbers 142241 and 102201 are palindromes, but 1023401 and 10510 — no. You want to represent a number n as the sum of two palindromes. Find the number of ways to do it.
There is only one line containing the integer n (1 ≤ n ≤ 1018).
Output one number — the number of ways to represent the number n as the sum of two palindromes.
156
4
9524
4
42657
6
5735832847451
28
In the first test, the following pairs of numbers are suitable: (5, 151), (55, 101), (101, 55), (151, 5).
In the second test, the following pairs of numbers are suitable: (515, 9009), (636, 8888), (8888, 636), (9009, 515).
In the third test, the following pairs of numbers are suitable: (33, 42624), (333, 42324), (4884, 37773), (37773, 4884), (42324, 333), (42624, 33).
ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2018 A번