luogu#P10496. The Luckiest Number
The Luckiest Number
题目描述
Chinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob has his own lucky number L. Now he wants to construct his luckiest number which is the minimum among all positive integers that are a multiple of L and consist of only digit '8'.
输入格式
The input consists of multiple test cases. Each test case contains exactly one line containing L(1 ≤ L ≤ 2,000,000,000).
The last test case is followed by a line containing a zero.
输出格式
For each test case, print a line containing the test case number( beginning with 1) followed by a integer which is the length of Bob's luckiest number. If Bob can't construct his luckiest number, print a zero.
题目大意
【题目描述】
中国人认为“8”是幸运数字。Bob 也喜欢数字“8”。此外,Bob 有自己的幸运数字 。现在,他想构造出自己的最幸运的数字,即所有仅由数字“8”组成且是 的倍数的正整数中的最小值。
【输入格式】
多个测试用例组成。每个测试用例包含一行,其中包含 ()。
最后一个测试用例后跟着一行,其中包含零。
【输出格式】
对于每个测试用例,输出一行,包含测试用例编号(从 开始),后跟一个整数,该整数是 Bob 最幸运的数字的长度。如果 Bob 无法构造他最幸运的数字,则输出零。
翻译来自于:ChatGPT
8
11
16
0
Case 1: 1
Case 2: 2
Case 3: 0