编程介的小学生 2017-05-13 05:26 采纳率: 20.5%
浏览 807
已采纳

Smart Sister

Description

Yesterday, Kamran was working on a report, which he must submit to his boss next Saturday. He became tired and went out of his working room to take a nap. After some minutes, her sister, Kamelia, who is a first year university student, came to the room and found the report. She thought, "How many large positive integers in a document. I hate these large numbers, they make me see nightmares! I should represent them in a more compact way". At first, she devised an ambiguous way to represent a number. She computed the product of digits of a number to find a new number and repeated this process again and again until she reached a one digit number (For example, 972 was transformed to 126 and then to 12 and finally to 2).

But she simply understood that this process is not reversible and tried to find another way (Since she loves Kamran too much, she did not want to destroy his efforts!). Suddenly, she noticed an interesting property in all the numbers of the report and called it productivity property in her mind. By her definition, a number with productivity property is a number that can be obtained by multiplying the digits of some other number (for instance, 126, 12, and 2 has productivity property, because they can be obtained from 972, 126, and 12 respectively). She thought, "Wow, I found it. If a number x in the report is the ith number in the increasing sequence of positive integers having productivity property, I will replace it by i". She replaced all numbers of the report, put a note for Kamran describing what she did with the numbers of his report and went to her friend's home in a blink of an eye!!!

It is not hard to imagine, how loudly Kamran screamed when he saw the report and the note from
Kamelia! In addition, he wondered how she did this! He thought "Again this naughty smart sister". Now, Kamran needs your help to find his original report numbers.

Input

Input begins with a number T showing the number of test cases and then, T test cases follow. Each test case includes a positive integer i which is the number written by Kamran's sister in the report. Please note than input includes thousands of test cases.

Output

For each test case, your program must output the original number x that was converted to the given i.
Please note that it is guaranteed that the output number is less than 1018.

Sample Input

4
10
1
40
11
Sample Output

10
1
80
12

  • 写回答

2条回答 默认 最新

  • devmiao 2017-05-30 15:35
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用