/ OPS / 题库 /

Divisible By Digits

Divisible By Digits

#描述#
An integer A starts with an integer B if the string representation of B is a prefix of the string representation of A (both in decimal notation with no leading zeroes).
Given an integer n, you are urged to find the smallest integer that starts with n and is divisible by every non-zero digit of n (all in decimal notation).

#格式#
##输入格式##
The input for each case will consist of one integer n, and n will be between 1 and 1000000000, inclusive.

##输出格式##
The output for each case shall be the smallest integer that starts with n and is divisible by every non-zero digit of n (all in decimal notation). The result of each case should be on a separate line. The input data will be chosen so that the result will always fit in a 64 bit integer.

#样例1#
##样例输入1##

13
648
566
1000000000
987654321
83

##样例输出1##

132
648
56610
1000000000
987654321360
8304

#限制#
1000ms
32768KB

#提示#
In the first case, we need a number that starts with 13 and is divisible by 1 (always true) and by 3. The smallest one is 132.

#来源#

信息

ID
1373
难度
5
分类
category1 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者