首页 > 其他 > 详细

ural One-two, One-two 2

时间:2015-09-28 11:26:50      阅读:280      评论:0      收藏:0      [点我收藏+]
 One-two, One-two 2
Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u
 
Description
A year ago the famous gangster Vito Maretti woke up in the morning and realized that he was bored of robbing banks of round sums. And for the last year he has been taking from banks sums that have only digits 1 and 2 in their decimal notation. After each robbery, Vito divides the money between N members of his gang. Your task is to determine the minimal stolen sum which is a multiple of N.

Input

The input contains the number N (1 ≤  N ≤ 10 6).

Output

Output the minimal number which is a multiple of N and whose decimal notation contains only digits 1 and 2. If it contains more than 30 digits or if there are no such numbers, then output "Impossible".

Sample Input

inputoutput
5
Impossible
8
112

 

AC代码:

 

ural One-two, One-two 2

原文:http://www.cnblogs.com/liugl7/p/4843423.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!