题解 | #进制转换#
进制转换
https://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6?tpId=37&tags=&title=&difficulty=0&judgeStatus=0&rp=1&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37
import java.util.Scanner; //0xAA 中0x是16进制标识,在做进制转化的时候要将前两位去掉,用substring做字符串截取 public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.hasNextLine()){ String str = sc.nextLine(); int answer = Integer.parseInt(str.substring(2),16); System.out.println(answer); } } }#23届找工作求助阵地#