logo AlgoBeat OnlineJudge
登录 注册

#216857. [GKS 2022 #A] Interesting Integers

内存限制:1024 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Let us call an integer interesting if the product of its digits is divisible by the sum of its digits. You are given two integers and . Find the number of interesting integers between and (both inclusive).

输入格式

The first line of the input gives the number of test cases, . lines follow.

Each line represents a test case and contains two integers: and .

输出格式

For each test case, output one line containing Case : , where is the test case number (starting from ) and is the number of interesting integers between and (inclusive).

样例

样例输入 1

4
1 9
91 99
451 460
501 1000

样例输出 1

Case #1: 9
Case #2: 0
Case #3: 5
Case #4: 176

数据范围与提示

In Sample Case #, since the product and the sum of digits are the same for single-digit integers, all integers between and are interesting.

In Sample Case #, there are no interesting integers between and .

In Sample Case #, there are interesting integers between and :

  1. (product of its digits is , sum of its digits is ).

  2. (product of its digits is , sum of its digits is ).

  3. (product of its digits is , sum of its digits is ).

  4. (product of its digits is , sum of its digits is ).

  5. (product of its digits is , sum of its digits is ).

Limits

.

Test Set

.

Test Set

.