F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Give Me an E

Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 283    Accepted Submission(s): 95


Problem Description
Everyone knows that the letter ¡°E¡± is the most frequent letter in the English language. In fact, there are one hundred sixteen E¡¯s on this very page ... no, make that one hundred twenty one. Indeed, when spelling out integers it is interesting to see which ones do NOT use the letter ¡°E¡±. For example 6030 (six thousand thirty) doesn¡¯t. Nor does 4002064 (four million two thousand sixty four).
It turns out that 6030 is the 64th positive integer that does not use an ¡°E¡± when spelled out and
4002064 is the 838th such number. Your job is to find the n-th such number.
Note: 1,001,001,001,001,001,001,001,001,000 is ¡°one octillion, one septillion, one sextillion, one quintil-lion, one quadrillion, one trillion, one billion, one million, one thousand¡±. (Whew!)
 

Input
The input file will consist of multiple test cases. Each input case will consist of one positive integer n (less than 231) on a line. A 0 indicates end-of-input. (There will be no commas in the input.)
 

Output
For each input n you will print, with appropriate commas, the n-th positive integer whose spelling does not use an ¡°E¡±. You may assume that all answers are less than 1028.
 

Sample Input
1 10 838 0
 

Sample Output
2 44 4,002,064
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-26 09:24:59, Gzip enabled