KevenKeven?今天上课刚刚学了?22?进制与?1010?进制的转化,但他觉得这个题目太简单了,于是他想加强一下这个题目,所以他考虑将?a - za?z?这26个小写字母分别表示?10-3510?35,并且希望你将一个?ss?进制的数字?nn?转化为?kk??进制的数字。
import java.io.*;
import java.math.BigInteger;
public class Main {
????????public static void main(String[] args)?throws IOException{
????????????BufferedReader br =?new BufferedReader(new InputStreamReader(System.in));
????????????String str;
????????????while((str=br.readLine()) !=?null){
????????????????String num = str;
????????????????String[] ss = br.readLine().split(" ");
????????????????int s = Integer.parseInt(ss[0]);
????????????????int k = Integer.parseInt(ss[1]);
//long n10 = Long.parseLong(num,s);?
//1)将S进制的n转化为10进制的n10;??Integer.paserInt(n,s);
//String nk = Long.toString(n10,k);?
//2)将10进制的n10转换为k进制的nk Integer.toString(n10,k);
//?System.out.println(nk);
???????????????System.out.println(new BigInteger(num,s).toString(k));
????????????}
????????}
}
|