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 人评分
Pascal三角 (C语言代码)格式错误浏览:520 |
P1001 (C语言代码)浏览:800 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:940 |
【亲和数】 (C语言代码)浏览:501 |
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C语言代码)浏览:613 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:637 |
C语言程序设计教程(第三版)课后习题8.9 (C语言代码)浏览:830 |
字符逆序 (C语言代码)浏览:614 |
1126题解浏览:585 |
【偶数求和】 (C语言代码)浏览:431 |