#P2518. [HAOI2010] 计数

    ID: 1533 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划,dp数学2010河南各省省选数位 dp

[HAOI2010] 计数

Description

{{You are given a number. You may delete any number of digit 0s (or none) from this number, and arbitrarily reorder the remaining digits. Count how many distinct numbers smaller than the original number can be produced in this way. Note that such a number must not have a leading zero.}}

Input Format

{{Only one line, an integer nn.}}

Output Format

{{Output a single integer, the answer.}}

1020
7

Hint

{{nn has length at most 50, and the answer does not exceed 26312^{63}-1.

Sample explanation: 12,21,102,120,201,210,100212,21,102,120,201,210,1002.}}

Translated by ChatGPT 5