import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
StringBuilder sb = new StringBuilder("");
String m="";
while(true) {
m=br.readLine();
if(m.charAt(0) =='0' && m.charAt(1) =='x'){
m=m.substring(2);
sb.append(Integer.parseInt(m, 16)).append("\n");
}else{
if(Integer.parseInt(m)<0){
break;
}
sb.append("0x").append(Integer.toHexString(Integer.parseInt(m)).toUpperCase()).append("\n");
}
}
System.out.print(sb);
}
}
No comments:
Post a Comment