#CCBOTPBA0000064. Khấu hao tài sản theo ba phương pháp (Asset Depreciation by Three Methods)
Khấu hao tài sản theo ba phương pháp (Asset Depreciation by Three Methods)
Asset Depreciation by Three Methods
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
An asset has an initial value and an expected life of years. Depreciation is deducted from its remaining value, initially . Choose one method using code :
- — Straight line: deduct the constant amount each year.
- — Declining balance: deduct times the remaining value at the beginning of the current year.
- — Sum of years: let . During year (numbered starting from ), deduct based on the original value.
Print the remaining value after each year in order. Keep unrounded intermediate values and round only each printed value. For methods 1 and 3, the remaining value after the final year is defined as zero to eliminate tiny floating-point artifacts.
Input
One line contains the real value and the integers and , in that order. is the initial asset value, is the number of years and chooses the method.
Output
Print exactly lines. Line contains the integer , one space, and the remaining value immediately after year , formatted with exactly two decimal digits. Do not print column headings or a currency symbol.
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input:
100 4 1
Output:
1 75.00
2 50.00
3 25.00
4 0.00
Explanation: The fixed annual deduction is 100/4 = 25. The remaining values are 75, 50, 25 and 0.
Example 2
Input:
100 4 2
Output:
1 50.00
2 25.00
3 12.50
4 6.25
Explanation: The annual rate is 2/4 = 0.5. Successive remaining values are 50, 25, 12.5 and 6.25.
Example 3
Input:
100 4 3
Output:
1 60.00
2 30.00
3 10.00
4 0.00
Explanation: The year weights sum to 10. Deducting 40, 30, 20 and 10 from the initial 100 gives remaining values 60, 30, 10 and 0.