import java.util.Scanner; import java.math.BigInteger; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意 hasNext 和 hasNextLine 的区别 while (in.hasNextBigInteger()) { // 注意 while 处理多个 case BigInteger n = in.nextBigInteger(); if(n.equals(BigInteger.valueOf(0))){ System.out.println(0); continue; } String res = ""; while(!n.equals(BigInteger.valueOf(0))){ //取模+除法 BigInteger temp = n.divideAndRemainder(new BigInteger("2"))[1]; res+=temp.toString(); //n进行除法 n = n.divide(new BigInteger("2")); } //倒序输出字符串 StringBuffer sb = new StringBuffer(res); System.out.println(sb.reverse()); } } }