No.491 10^9+1 and Palindromes
タグ : / 解いたユーザー数 150
作問者 :
e869120
/ テスター :
Problem Statement
5 000 000 005 is a multiple of $10^9+1$ and a palindrome.
You are given an integer N. Find the number of integers between 1 and N, inclusive, that are multiples of $10^9+1$ and palindromes.
Here, a palindromic number is a number that reads the same from right to left as from left to right, such as "969", "3223", and "1".
Input
N
The first line contains an integer $N(1 \le N \le 10^{18})$.
Output
Output on one line the number of integers between 1 and N, inclusive, that are multiples of $10^9+1$ and palindromes. Print a newline at the end.
Sample
Sample 1
Input
4000000000
Output
3
1000000001,2000000002,3000000003 satisfy the conditions.
Sample 2
Input
40000000000
Output
12
There are 12 such numbers: 1000000001,2000000002,3000000003, 4000000004,5000000005,6000000006, 7000000007,8000000008,9000000009, 11000000011,22000000022,33000000033.
Sample 3
Input
1000000007
Output
1
One billion and seven!
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。