CF1575D.Divisible by Twenty-Five
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Mr. Chanek has an integer represented by a string s. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the number of possible integer s, where s is divisible by 25. Of course, s must not contain any leading zero. He can replace the character _ with any digit. He can also replace the character X with any digit, but it must be the same for every character X.
As a note, a leading zero is any 0 digit that comes before the first nonzero digit in a number string in positional notation. For example, 0025 has two leading zeroes. An exception is the integer zero, (0 has no leading zero, but 0000 has three leading zeroes).
Chanek 先生有一个由字符串 s 表示的整数。其中零个或多个数字已被擦除,用字符 _ 表示;此外,还有零个或多个数字被标记为字符 X,表示这些位置上的数字必须相同。
Chanek 先生希望统计满足以下条件的可能整数 s 的个数:s 能被 25 整除。当然,s 不能包含前导零。他可以将每个 _ 替换为任意一个数字;也可以将每个 X 替换为任意一个数字,但所有 X 必须被替换为同一个数字。
注意:前导零是指在位值记法的数字字符串中,出现在第一个非零数字之前的任何 0。例如,0025 有两个前导零。例外情况是整数 0(即字符串 "0" 没有前导零,但 "0000" 有三个前导零)。
输入格式
One line containing the string s (1≤∣s∣≤8). The string s consists of the characters 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, _, and X.
一行包含字符串 s(1≤∣s∣≤8)。字符串 s 由字符 0、1、2、3、4、5、6、7、8、9、_ 和 X 组成。
输出格式
Output an integer denoting the number of possible integer s.
输出一个整数,表示满足条件的整数 s 的可能个数。
输入输出样例
输入#1
25
输出#1
1
输入#2
_00
输出#2
9
输入#3
_XX
输出#3
9
输入#4
0
输出#4
1
输入#5
0_25
输出#5
0
说明/提示
In the first example, the only possible s is 25.
In the second and third example, s∈100,200,300,400,500,600,700,800,900.
In the fifth example, all possible s will have at least one leading zero.
在第一个例子中,唯一可能的 s 是 25。
在第二个和第三个例子中,s∈100,200,300,400,500,600,700,800,900。
在第五个例子中,所有可能的 s 都至少有一个前导零。
输入解题思路,AI测评打分。不知道怎么写?