poj 1426

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;


public class Main1426 {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		BigInteger a,b;
		BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
		long c=0,d=0,n=0;
		while((n=Long.parseLong(stdin.readLine()))!=0){
			b=new BigInteger(1+"");
			d=1;
			while(true){
				c=Long.parseLong(Long.toBinaryString(d));//以二进制无符号整数形式返回d 参数的字符串表示形式。
				if(c%n==0)break;
				d++;
			}
			System.out.println(Long.toBinaryString(d));
		}
	}

}

你可能感兴趣的:(c,String,Class,import)