AtCoder Regular Contest 142
翻译中…
Problem Statement
翻译中…
For a positive integer $x$, let $f(x)$ be the answer to the question below.
翻译中…
The following operation on
$x$can be performed zero or more times.
- Let
$x'$be the integer obtained by reversing the decimal notation of$x$. Then, replace$x$with$x'$. If$x$now has one or more leading zeros, delete them so that it begins with a non-zero digit.For example, from
$x=1420$, you get$x=241$after one operation,$x=142$after two operations, and$x=241$after three operations. Find the minimum possible value of$x$after operations.
翻译中…
Find the number of integers $x$ such that $1 \leq x \leq N$ and $f(x)=K$.
翻译中…
Constraints
翻译中…
$1 \leq N,K \leq 10^{12}$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N K
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
1420 142
Output #1
3
Three integers $x=142$, $241$, and $1420$ satisfy $1 \leq x \leq 1420$ and $f(x)=142$.
Input #2
1419 142
Output #2
2
Input #3
6 19
Output #3
0
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。