2 shunfurh shunfurh 于 2017.09.14 14:28 提问

Numerically Speaking

Description

A developer of crossword puzzles (and other similar word games) has decided to develop a mapping between every possible word with from one to twenty characters and unique integers. The mapping is very simple, with the ordering being done first by the length of the word, and then alphabetically. Part of the list is shown below.

a          1

b          2

...

z          26

aa         27

ab         28

...

snowfall   157,118,051,752

...

Your job in this problem is to develop a program which can translate, bidirectionally, between the unique word numbers and the corresponding words.
Input

Input to the program is a list of words and numbers, one per line starting in column one, followed by a line containing a single asterisk in column one. A number will consist only of decimal digits (0 through 9) followed immediately by the end of line (that is, there will be no commas in input numbers). A word will consist of between one and twenty lowercase alphabetic characters (a through z).
Output

The output is to contain a single line for each word or number in the input data. This line is to contain the word starting in column one, followed by an appropriate number of blanks, and the corresponding word number starting in column 23. Word numbers that have more than three digits must be separated by commas at thousands, millions, and so forth.
Sample Input

29697684282993
transcendental
28011622636823854456520
computationally
zzzzzzzzzzzzzzzzzzzz
*
Sample Output

elementary 29,697,684,282,993
transcendental 51,346,529,199,396,181,750
prestidigitation 28,011,622,636,823,854,456,520
computationally 232,049,592,627,851,629,097
zzzzzzzzzzzzzzzzzzzz 20,725,274,851,017,785,518,433,805,270

1个回答

devmiao
devmiao   Ds   Rxr 2017.09.30 08:32
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
hdu 1314 Numerically Speaking
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=1314
Numerically Speaking
There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can'
ZJU 1272 Numerically Speaking
大数问题...... 根据先余为低位,
UVa 619 - Numerically Speaking
題目:已知十進制和二十六進制的串,將他們相互轉化,輸出數字每三位一個分隔。 分析:數學,進制轉換。兩個方向的轉化是相同的,除了基數。 說明:注意輸出格式和數據長度。 #include #include #include #include #include #include char string[101]; char answer[101]; int number[101];
HDU 1312 Numerically Speaking
哈希
POJ 1312 Numerically Speaking
http://poj.org/problem?id=1312 看清楚题目可以看到是一个进制转换的问题 没写出来 看了别人的代码 //========================================================
POJ 1312 Numerically Speaking 笔记
如上表,将所有的字母组合按字典序排序。给出字母组合求其序列数,或给出序列数求字母组合。
day6 HDU 1312 Numerically Speaking
地图上的BFS,在每个点的访问标志上记录步数能节省一些空间 #include"iostream" #include"queue" using namespace std; queueq; int sum=1; int m,n,x,y; char g[25][25]; int v[25][25]; int dx[4]={0,0,1,-1}; int dy[4]={1,-1,0,0};
Numerically Speaking hdu 1314 大数模拟
Numerically SpeakingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 766 Accepted Submission(s): 190Problem Description A developer of cross
POJ 完整分类
DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  1024   Calendar Game       简单题  1027   Human Gene Functions   简单题  1037   Gridland            简单题  1052   Algernon s Noxious