CF2241B.Good times Good times
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
An integer n is said to be good if it contains at most two distinct digits in its decimal representation. For example, the integers 3, 8588, 67 are good, whereas the integers 123, 9447 are not.
You are given an integer x (1≤x<108), which is good. Your task is to find an integer y (2≤y≤109) such that both of the following conditions are satisfied:
- y is good.
- x×y is good.
若一个整数 n 的十进制表示中至多包含两种不同的数字,则称其为“好数”。例如,整数 3、8588、67 是好数,而整数 123、9447 不是好数。
给定一个整数 x(1≤x<108),它保证是好数。你的任务是找出一个整数 y(2≤y≤109),使得同时满足以下两个条件:
- y 是好数;
- x×y 是好数。
输入格式
The first line contains an integer t (1≤t≤104) — the number of test cases. The description of each test case follows.
Each test case contains a single integer x (1≤x<108). It is guaranteed that x is good.
第一行包含一个整数 t(1≤t≤104)—— 测试用例的数量。接下来是每个测试用例的描述。
每个测试用例包含一个整数 x(1≤x<108)。保证 x 是“好”的。
输出格式
For each test case, print a single integer y (2≤y≤109) such that both the integers y and x×y are good.
If there are multiple valid answers, output any one of them.
对于每个测试用例,输出一个整数 y(2≤y≤109),使得整数 y 和 x×y 均为“好”的数。
若存在多个合法答案,输出其中任意一个即可。
输入输出样例
输入#1
4 8 73 299 6767
输出#1
11 4 26 3366
说明/提示
For the first test case, we have x=8; choosing y=11 is valid because both y=11 and x×y=88 are good.
For the second test case, we have x=73; choosing y=4 is valid because both y=4 and x×y=292 are good.
对于第一个测试用例,我们有 x=8;选择 y=11 是合法的,因为 y=11 和 x×y=88 均为“好”的数。
对于第二个测试用例,我们有 x=73;选择 y=4 是合法的,因为 y=4 和 x×y=292 均为“好”的数。
输入解题思路,AI测评打分。不知道怎么写?