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

建议使用的浏览器:

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

4376:Simple Counting

题目描述
  Totalfrank and wlkilluajay have their lucky numbers. As we all know, 16 or any number contains 16 (116 for example) is lucky number for totalfrank and 2 or any number contains 2 (1723 for example) is lucky number for wlkilluajay.
  Totalfrank is a normal guy who reads from left to right while wlkilluajay enjoys reading from right to left which means 16 to totalfrank is 61 to wlkilluajay.
  Since their lucky numbers changes often, here is the simple counting question for you: given totalfrank’s and wlkilluajay’s lucky number and an interval, how many numbers in the given interval is at least a lucky number for one of them? Notice that wlkilluajay always read from right to left so a number which is outside the interval (in totalfrank’s perspective) may be inside the interval when it is read from right to left (in wlkilluajay’s perspective), you should also count that in (See samples for more details). By the way, because they read from different direction, 0 may be a problem (for example, if 2 is a lucky number for wlkilluajay, then 20, 200… is also a lucky number for her. But when read from right to left, they are all just 2 and there may be infinite lucky numbers for her in a given interval in a normal guy’s eyes). From this aspect, they decide to ignore any number contains 0.
输入解释
The input contains no more than 50 test cases.
The first line contains a single integer T indicating the number of test cases.
For each test case:
  The first line of each test case includes two integers a (1 <= a <= 1018) and b (a <= b <= 1018).
  The second line contains two integers c (1 <= c <= 1018) and d (1 <= d <= 1018). c is the lucky number for totalfrank and d is the lucky number for wlkilluajay (c and d won’t contain any 0).
输出解释
For each test case, first you should print “Case #x: ” (without quotes), where x stands for the case number started with 1 and then a single integer indication the answer to the question.
输入样例
2

62 62
62 62

1 9999
53 23
输出样例
Case #1: 2
Case #2: 501
提示
For the first case, 62 is a lucky number for totalfrank and 26 is a lucky number for wlkilluajay (when read from right to left, it is 62 which fills in the interval 
[62, 62]).So the answer is 2 (26 and 62).
来自杭电HDUOJ的附加信息
Recommend zhuyuanchen520

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4376

最后修改于 2020-10-25T23:12:56+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)