题解 | 进制转换
进制转换
https://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
parseInt
方法,它在Java中用于将字符串解析为整数,后面的16表示要转化的字符串以16进制看待。
#牛客春招刷题训练营# https://www.nowcoder.com/discuss/730470342107340800
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); while(sc.hasNextLine()){ String s = sc.nextLine(); System.out.println(Integer.parseInt(s.substring(2,s.length()),16)); } } }#牛客春招刷题训练营#