Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Language: Apocalypse Someday
Description The number 666 is considered to be the occult “number of the beast” and is a well used number in all major apocalypse themed blockbuster movies. However the number 666 can’t always be used in the script so numbers such as 1666 are used instead. Let us call the numbers containing at least three contiguous sixes beastly numbers. The first few beastly numbers are 666, 1666, 2666, 3666, 4666, 5666… Given a 1-based index n, your program should return the nth beastly number. Input The first line contains the number of test cases T (T ≤ 1,000). Each of the following T lines contains an integer n (1 ≤ n ≤ 50,000,000) as a test case. Output For each test case, your program should output the nth beastly number. Sample Input 3 2 3 187 Sample Output 1666 2666 66666 Source POJ Monthly--2007.03.04, Ikki, adapted from TCHS SRM 2 ApocalypseSomeday |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator