Most of a system's cost comes after the first release. Estimate StudyBuddy's lifetime cost.
Input (one line): D P Y G
D— cost of the first version (development), in yuan (a real number);P— maintenance cost in year 1, as a percentage of D (e.g.20means 20% of D);Y— number of years in operation (integer, 0 or more);G— yearly growth of maintenance cost, in percent (the system gets bigger and older: year k costs(1 + G/100)times year k−1).
Print, with one decimal (String.format("%.1f", x)):
Year 1: <cost>
...
Year Y: <cost>
Development: <D>
Maintenance: <sum of all years>
Total: <D + maintenance>
Maintenance share: <percent of total>%
then Maintenance exceeds development in year k for the first year in which the cumulative maintenance cost becomes strictly greater than D, or Maintenance never exceeds development if it never does. If Y is 0, print no year lines and a share of 0.0%.
Input 100000 20 5 10 gives:
Year 1: 20000.0
Year 2: 22000.0
Year 3: 24200.0
Year 4: 26620.0
Year 5: 29282.0
Development: 100000.0
Maintenance: 122102.0
Total: 222102.0
Maintenance share: 55.0%
Maintenance exceeds development in year 5