请高手指点迷津!急!在线恭候...
It is really amazing that the great historian Dr.K has recently found that about 10 Million years ago, in the area where is now called China, lived an ancient people. They may be considered as the first intelligent creature existed on the earth.
As Dr.K's investigation advance, he found unbelievably that they even developed some so-called mathematics during their evolvement. Dr.K spent his half life to understand this ancient people's counting system. Finally he got to know that:
1、They use only 7 digits to represent numbers, and numbers are as follow:
| -> 1
|| -> 2
||| -> 3
|||| -> 4
||||| -> 5
|||||| -> 6
||||||| -> 7
It is a pity that they have not developed "0" before these people disappeared.
2、If a number is greater than 7, they use digit place just as we do today. Between each two digit places, there is a ",".
eg:
|||||,|| -> 42 (5x8+2)
|||,||,|||| -> 212 (3*64+2*8+4)
In order to further his study, Dr.K wants to know what the sequences found from stones mean in today's counting system. He turns to you for help, and smart as you are, you should help this great historian,should not you?
Input
The first line of standard input contains an integer N, the number of test cases. N lines followed.
In each line a sequence is given, it is guaranteed that the length of the sequence will not exceed 1024 characters and the outcome number will not be greater than 1000000.
Output
For each case you are to output a line giving the number in today's decimal counting system.
Sample Input
3
|||||,||
|||,||,||||
||,|,|,|,||||
Sample Output
42
212
8780
As Dr.K's investigation advance, he found unbelievably that they even developed some so-called mathematics during their evolvement. Dr.K spent his half life to understand this ancient people's counting system. Finally he got to know that:
1、They use only 7 digits to represent numbers, and numbers are as follow:
| -> 1
|| -> 2
||| -> 3
|||| -> 4
||||| -> 5
|||||| -> 6
||||||| -> 7
It is a pity that they have not developed "0" before these people disappeared.
2、If a number is greater than 7, they use digit place just as we do today. Between each two digit places, there is a ",".
eg:
|||||,|| -> 42 (5x8+2)
|||,||,|||| -> 212 (3*64+2*8+4)
In order to further his study, Dr.K wants to know what the sequences found from stones mean in today's counting system. He turns to you for help, and smart as you are, you should help this great historian,should not you?
Input
The first line of standard input contains an integer N, the number of test cases. N lines followed.
In each line a sequence is given, it is guaranteed that the length of the sequence will not exceed 1024 characters and the outcome number will not be greater than 1000000.
Output
For each case you are to output a line giving the number in today's decimal counting system.
Sample Input
3
|||||,||
|||,||,||||
||,|,|,|,||||
Sample Output
42
212
8780
...全文
相关推荐
急采购物品请购单DOC
在压缩包中包含的文件名为“下载自www.glzy8.com管理资源吧”急采购物品请购单.DOC,这个文件名可能表示文档来源于一个在线管理资源平台,glzy8.com,这个平台可能提供了许多类似的管理工具和模板
恭候顾客站姿标准
在这一背景下,恭候顾客站姿标准成为了超市服务人员必须掌握的基本技能之一。它不仅是专业服务的体现,更是良好客户体验的基础。
急采购物品请购单.doc
"急采购物品请购单.doc" 是一个管理表格,主要用于企业或组织内部记录紧急采购物品的需求、审批和支付情况。这种请购单是供应链管理和财务控制的重要工具,它确保了购买流程的规范性和透明度。
李开复为青年指点迷津_与未来同行
李开复为青年指点迷津_与未来同行,经典书籍,是可执行文件,下载后请把重命名删去
行业文档-设计装置-简易在线带钢急峻度测量平台.zip
【标题解析】标题"行业文档-设计装置-简易在线带钢急峻度测量平台.zip"揭示了这个压缩包文件的主要内容,它包含了关于一个特定行业的技术文档,具体是关于设计一种装置,该装置用于在线测量带钢的急峻度。"


