题解 | #明明的随机数#
进制转换
http://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
import java.util.Scanner;
public class SixteenToTen
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
String snum = sc.nextLine();
function(snum);
}
}
private static void function(String snum) { snum = snum.substring(2); // 把一个字符串类型转换成一个16进制的整数 System.out.println(Integer.parseInt(snum,16)); }
居然能过,哈哈