import java.io.*; public class Main { static BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); public static void main(String[] args) throws IOException,NullPointerException { String[] temp=bf.readLine().split(" "); int k=Integer.parseInt(temp[0]); int N=Integer.parseInt(temp[1]); String s=Integer.toString(N, 2); pw.print(Integer.parseInt(s,k)); pw.flush(); } }
解题思路:
看数据,加的格式就是二进制,那也很好理解了,把N转换成二进制,再把二进制转换成K进制算就可以了
0.0分
1 人评分
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:542 |
陶陶摘苹果 (C语言代码)浏览:1603 |
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:1066 |
C语言程序设计教程(第三版)课后习题6.5 (C语言代码)浏览:748 |
简单的a+b (C语言代码)浏览:596 |
WU-蓝桥杯算法提高VIP-交换Easy (C++代码)浏览:1107 |
矩形面积交 (C++代码)浏览:1127 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:534 |
Pascal三角 (C语言代码)浏览:641 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:946 |