Mackenzie New Year's Challenge P2 - Moore's Law

View as PDF

Submit solution

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

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


Sample Output 1


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


Sample Output 2



  • -2
    Jeffmagma  commented on Dec. 30, 2015, 8:53 p.m. edited

    Why is there 2 Sample Input 2?

    • 1
      aurpine  commented on Dec. 31, 2015, 12:06 p.m.

      There are two sample inputs with two respective outputs. If that's what you mean. Two sample test cases to help you make sure that your program is correct.

  • 7
    kushanzaveri  commented on Dec. 30, 2015, 11:14 a.m.

    Hey that's me!