POJ1546
来源:互联网 发布:星达字段拼凑软件 编辑:程序博客网 时间:2024/05/01 04:14
Problem: Basically Speaking
Description: 16进制以内的转换。
Solution: JAVA中的Integer和String中提供了很多方便的方法,于是偷懒用了JAVA做了。
Code(JAVA):
import java.util.Scanner;public class Main{ private Scanner cin=new Scanner(System.in); Main(){ while(cin.hasNext()){ String tmp=cin.next(); int pre_base=cin.nextInt(); int now_base=cin.nextInt(); int pre_num=Integer.parseInt(tmp, pre_base); String now_num=Integer.toString(pre_num, now_base); if(now_num.length()>7) System.out.print(String.format("%7s\n", "ERROR")); else System.out.print(String.format("%7s\n", now_num.toUpperCase())); } } public static void main(String[] args) { new Main(); }}
1 0
- POJ1546
- POJ1546 Basically Speaking
- HDU1335 POJ1546 UVA389 Basically Speaking
- POJ1546 & HDU 1335 & ZOJ 1334 Basically Speaking(进制转换)
- 第5周项目1:三角形类雏形(1)
- 稀疏矩阵的十字链表表示法及其加法减法运算算法
- android 单线程多任务断点排队下载(支持多界面刷新)
- hdu2608 数论,规律
- 史诗级梦境之二:沙漠大逃亡
- POJ1546
- 第二周项目:求一个数的阶乘
- 【tyvj1473】校门外的树3
- 面试题 多线程 顺序操作
- 第五周项目2 游戏中角色类的设计(2)
- 从控制台输入年、月、日,打印本月日历,用*标示输入的日期
- js权威指南里面的贷款计算器
- android json解析及简单例子
- 第五周上机实践项目1(1):三角形类雏形