2013
11-09

# Find The Multiple

Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more than 100 decimal digits.

The input file may contain multiple test cases. Each line contains a value of n (1 <= n <= 200). A line containing a zero terminates the input.

For each value of n in the input print a line containing the corresponding value of m. The decimal representation of m must not contain more than 100 digits. If there are multiple solutions for a given value of n, any one of them is acceptable.

2
6
19
0

10
100100100100100100
111111111111111111

//* @author  [email protected]/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */
import java.io.IOException;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) throws IOException {
BigInteger a;
BigInteger b;
long c=0,d=0;
long n=0;
//for(n=1;n<=200;n++)   {
b=new BigInteger(1+"");
d=1;
while(true){
c=Long.parseLong(Long.toBinaryString(d));
//a=new BigInteger(b.toString(2));
//if(a.mod(new BigInteger(n+"")).toString().equals("0"))break;
if(c%n==0) break;
}