2 shunfurh shunfurh 于 2016.09.20 21:14 提问

NUMBER BASE CONVERSION这个题目怎么做?

Description

Write a program to convert numbers in one base to numbers in a second base. There are 62 different digits:
{ 0-9,A-Z,a-z }
HINT: If you make a sequence of base conversions using the output of one conversion as the input to the next, when you get back to the original base, you should get the original number.
Input

The first line of input contains a single positive integer. This is the number of lines that follow. Each of the following lines will have a (decimal) input base followed by a (decimal) output base followed by a number expressed in the input base. Both the input base and the output base will be in the range from 2 to 62. That is (in decimal) A = 10, B = 11, ..., Z = 35, a = 36, b = 37, ..., z = 61 (0-9 have their usual meanings).
Output

The output of the program should consist of three lines of output for each base conversion performed. The first line should be the input base in decimal followed by a space then the input number (as given expressed in the input base). The second output line should be the output base followed by a space then the input number (as expressed in the output base). The third output line is blank.
Sample Input

8
62 2 abcdefghiz
10 16 1234567890123456789012345678901234567890
16 35 3A0C92075C0DBF3B8ACBC5F96CE3F0AD2
35 23 333YMHOUE8JPLT7OX6K9FYCQ8A
23 49 946B9AA02MI37E3D3MMJ4G7BL2F05
49 61 1VbDkSIMJL3JjRgAdlUfcaWj
61 5 dl9MDSWqwHjDnToKcsWE1S
5 10 42104444441001414401221302402201233340311104212022133030
Sample Output

62 abcdefghiz
2 11011100000100010111110010010110011111001001100011010010001

10 1234567890123456789012345678901234567890
16 3A0C92075C0DBF3B8ACBC5F96CE3F0AD2

16 3A0C92075C0DBF3B8ACBC5F96CE3F0AD2
35 333YMHOUE8JPLT7OX6K9FYCQ8A

35 333YMHOUE8JPLT7OX6K9FYCQ8A
23 946B9AA02MI37E3D3MMJ4G7BL2F05

23 946B9AA02MI37E3D3MMJ4G7BL2F05
49 1VbDkSIMJL3JjRgAdlUfcaWj

49 1VbDkSIMJL3JjRgAdlUfcaWj
61 dl9MDSWqwHjDnToKcsWE1S

61 dl9MDSWqwHjDnToKcsWE1S
5 42104444441001414401221302402201233340311104212022133030

5 42104444441001414401221302402201233340311104212022133030
10 1234567890123456789012345678901234567890

1个回答

caozhy
caozhy   Ds   Rxr 2016.09.20 21:14
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
NUMBER BASE CONVERSION(进制转化)
解题思路: 题目大意是给一个a进制的数,让你化作b进制,给的数会很大。
NUMBER BASE CONVERSION(大数进制转换)
NUMBER BASE CONVERSION Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4580   Accepted: 2095 Description Write a program to convert numbers in one base to nu
POJ 1220-NUMBER BASE CONVERSION 任意进制数转换
题目大意:给出两个进制oldBase 和newBase, 以及以oldBase进制存在的数。要求将这个oldBase进制的数转换成newBase进制的数。 解决方式是短除法; 对8进制数number 454  转为10进制数 ,number 长度为len ----------------------------- 那么先对number 的前len-1位去短除10; a
1220 NUMBER BASE CONVERSION【高精度进制转化】
NUMBER BASE CONVERSION Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4909   Accepted: 2242 Description Write a program to convert numbers in one base to
NUMBER BASE CONVERSION(高精度)
Description Write a program to convert numbers in one base to numbers in a second base. There are 62 different digits:  { 0-9,A-Z,a-z }  HINT: If you make a sequence of base conversions using t
poj1220 NUMBER BASE CONVERSION
任意进制的高精度转换  问题描述: 已知:位数为K(0 求:转换为M进制(2 ≤ M ≤62)后的新数Q 输入:第1行为case数T;第2至第T+1行为T个case,每行输入均为N、M以及P,用空格分隔 输出:采用以下形式输出 N P M Q 空行 …
【LeetCode】ZigZag Conversion 解题报告
【题目】 The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N
进制转换(Hex Conversion)
      个人第一篇博客,很早就有写博客的想法,今天才实施,拖延症晚期,得改!!先说下题目,刚看到这个题目很懵逼,英语不好,看不懂(汗颜),借助有道才知道题目干啥得。好了,进入正题。进制转换就不做过多解释,直接上代码 public string HexConversion(int n, int k) { if (n == 0) return "0"; //特殊情况...
list agg cause ORA-06502 PL/SQL: numeric or value error
http://www.idb-stock.net/idb/2011/07/05/204.html ora-06502错误主要是指数据字或值错误,包括以下子类型:字符到数据值的转换错误、字符串缓冲区太小、数值精度太高等。 对空集合的调用,会报ora-06502错误 view plaincopy to clipboardprint? declare    type cnt_ty
这个题目怎么做
函数 Temp() 是一个产生1-10000000000的随机数现在运行Temp() 100000000 次要你输出 Temp()产生的数字(如有重复的就不输出来)Exp:运行Temp() 7 次产生:8、5、6、8、4、4、8Output: 4568