MNYC '16: Moore's Law

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

Kushan has the Google Nexus 6P, the latest flagship Android Smartphone. He waited a long time for technology to advance to his preferences. A version of Moore's law states that the performance of technology doubles every 24 months (2 years). The Nexus 6P has a processor clock speed of 2.0 GHz. Using the law explained and the clock speed of the Nexus 6P processor, help Kushan find the soonest time when he can get a phone with a C GHz or better processor. Output the time he has to wait in years, months, weeks and days. Assume 365 days in a year, 30 days in a month and 7 days in a week. (Yes, that means that there are 12 months and 5 days in a year). If you had to wait 720 days, you would output 1Y 11M 3W 4D. If any one of the time units are 0, omit both the number and the unit. E.g. 1Y instead of 1Y 0M 0W 0D. If he has to wait 0 years, 0 months, 0 weeks and 0 days, output Now!.

Input Specification

2.0 \le C \le 10^9

Output Specification

The time to wait until a phone with a C GHz processor can be bought, or Now! if the time to wait is 0.

Sample Input 1

4.0

Sample Output 1

2Y

Explanation for Sample Output 1

Kushan has to wait 2 years for the clock speed to double from 2.0 GHz to 4.0 GHz.

Sample Input 2

2.828427124

Sample Output 2

1Y

Comments