import java.math.BigInteger;
import java.util.Scanner;
import static java.lang.Integer.parseInt;
public class PTA1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
BigInteger n= input.nextBigInteger();
System.out.println(n.toString(2));
}
}
原代码:报错 For input string: "52" under radix 2
import java.math.BigInteger;
import java.util.Scanner;
import static java.lang.Integer.parseInt;
public class PTA1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int k = input.nextInt();
String s = Integer.toString(k);
System.out.println(Integer.parseInt(s,2));
}
}