列表

详情


NC51332. digits 2

描述

You are given a positive integer n which is at most 100.

Please find a positive integer satisfying the following conditions:

1. The sum of all digits of this number is dividable by n.

2. This number is also dividable by n.

3. This number contains no more than digits.

If such an integer doesn't exist, output "Impossible" (without quotation marks).
If there are multiple such integers, please output any one.

输入描述

The first line contains one integer T indicating that there are T tests.

Each test consists an integer n in a single line.

*

*

输出描述

For each query, output one line containing the answer. The number you print cannot have leading zeros. If there are multiple answers, you can print any. If such an integer doesn't exist, output "Impossible" (without quotation marks) in a single line.

示例1

输入:

3
1
9
12

输出:

1
666666
888

说明:

For the last test, 888 is dividable by 12 (888 = 12 * 74) and 8 + 8 + 8 = 24 is also dividable by 12 (24 = 12 * 2).

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

Python3(3.5.2) 解法, 执行用时: 31ms, 内存消耗: 3424K, 提交时间: 2019-08-05 19:55:33

for i in range(int(input())):
	n = input()
	print(n * int(n))

上一题