HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Data Structures > problem:


50306 - Beautiful Numbers

Guest
• Review clarifications (1)

Volume problems

• 50704 - Connected?
• 50705 - Student Clubs
• 50779 - The shortest path in a maze
• 180. 50776 - The number of differen...
• 2007.A. 51071 - Phalanx-2
• 50. 50718 - Elevator
• 50711 - Snail Trails
• 50674 - Collecting Eggs
• 50306 - Beautiful Numbers
• 50411 - Sum of the Leaves
• 50675 - Kruja Boys
• 50421 - Repairing road segments
• 50736 - Top N Donors - 2
• 50775 - Balanced Parenthesis
• 50774 - Hot Potato
• 50464 - From Tirana to Durres
• 50757 - National Elections - 1

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Geri Gokaj.

Beautiful Numbers

John really likes the numbers 3 and 7. So Maria made him a gift for his birthday. She gave him an integer N which is made up of only 3’s and or 7’s.
John was really touched by this beautiful gift and wanted to know how much Maria kept searching for this number. You will be given a number N (a beautiful number) and than you will find the how many’th beautiful number it is. A beautiful number is considered a number to have either 3 or 7 or both in it.

Input specification
An integer number N(beautiful number) where N is smaller than 4x108

Output specification
An integer that represents the order of the beautiful number.

Sample Input I
3
Sample Input II
7
Sample Input III
373
Sample Output I
1
Sample Output II
2
Sample Output III
9


Output Explanation:
Number 373 is the 9th beautiful number in ascending order
Previous beautiful numbers are 3,7,33,37,73,77,333,337

Äëÿ îòïðàâêè ðåøåíèé íåîáõîäèìî âûïîëíèòü âõîä.

www.contester.ru