当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3340:Barbara Bennett's Wild Numbers

题目描述

A wild number is a string containing digits and question marks (like 36?1?8). A number X matches a wild number W if they have the same length, and every non-question mark character in X is equal to the character in the same position in W (it means that you can replace a question mark with any digit). For example, 365198 matches the wild number 36?1?8, but 360199, 361028, or 36128 does not. Write a program that reads a wild number W and a number X from input, both of length n, and determines the number of n-digit numbers that match W and are greater than X.

输入解释

There are multiple test cases in the input. Each test case consists of two lines of the same length. The first line contains a wild number W, and the second line contains an integer number X. The length of input lines is between 1 and 10 characters. The last line of input contains a single character #.

输出解释

For each test case, write a single line containing the number of n-digit numbers matching W and greater than X (n is the length of W and X).

输入样例
36?1?8
236428
8?3
910
?
5
#
输出样例
100
0
4

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Tehran 2006

源链接: POJ-3340

最后修改于 2020-10-29T06:59:12+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000 65536