CF991E.Bus Number
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at least one more time, but the losestreak only grew longer and longer... It's no wonder he didn't get any sleep this night at all.
In the morning, Vasya was waiting the bus to the university on the bus stop. Vasya's thoughts were hazy and so he couldn't remember the right bus' number quite right and got onto the bus with the number n.
In the bus, Vasya thought that he could get the order of the digits in the number of the bus wrong. Futhermore, he could "see" some digits several times, but the digits he saw were definitely in the real number of the bus. For example, if Vasya saw the number 2028, it could mean that the real bus number could be 2028, 8022, 2820 or just 820. However, numbers 80, 22208, 52 definitely couldn't be the number of the bus. Also, real bus number couldn't start with the digit 0, this meaning that, for example, number 082 couldn't be the real bus number too.
Given n, determine the total number of possible bus number variants.
今夜对瓦夏来说并不轻松。他最喜爱的球队输了,而他自己也未能取胜——尽管他发挥完美,但队友却一次次让他失望。他至少还需要赢一次,然而连败纪录却越来越长……难怪他整晚都毫无睡意。
清晨,瓦夏在公交站等待前往大学的公交车。他的思绪模糊不清,以至于没能准确记起正确公交车的编号,结果登上了编号为 n 的公交车。
在车上,瓦夏想到自己可能看错了公交车编号中各位数字的顺序。此外,他可能将某些数字“看成”了多次,但他所看到的数字必定全部出现在真实的公交车编号中。例如,若瓦夏看到的数字是 2028,则真实的公交车编号可能是 2028、8022、2820 或仅仅是 820。然而,80、22208 和 52 等数字绝不可能是真实的公交车编号。另外,真实的公交车编号不能以数字 0 开头,这意味着例如 082 这样的数字也不能是真实的公交车编号。
给定 n,请确定可能的公交车编号总数。
输入格式
The first line contains one integer n (1≤n≤1018) — the number of the bus that was seen by Vasya. It is guaranteed that this number does not start with 0.
第一行包含一个整数 n(1≤n≤1018)——即瓦夏所看到的公交车编号。保证该编号不以 0 开头。
输出格式
Output a single integer — the amount of possible variants of the real bus number.
输出一个整数——可能的真实公交车号码的种类数。
输入输出样例
输入#1
97
输出#1
2
输入#2
2028
输出#2
13
说明/提示
In the first sample, only variants 97 and 79 are possible.
In the second sample, the variants (in the increasing order) are the following: 208, 280, 802, 820, 2028, 2082, 2208, 2280, 2802, 2820, 8022, 8202, 8220.
在第一个样例中,仅有 97 和 79 两种可能。
在第二个样例中,所有可能的数(按升序排列)如下:208、280、802、820、2028、2082、2208、2280、2802、2820、8022、8202、8220。
输入解题思路,AI测评打分。不知道怎么写?