#PCBBAY0000011. Tỉ lệ thay đổi phần trăm (Percentage Change)
Tỉ lệ thay đổi phần trăm (Percentage Change)
Percentage Change
Version: Phuoc Hung OJ Extended
Problem Statement
Given an initial value and a new value , compute the relative change . Display the change as a percentage with exactly 2 decimal places. A positive result means an increase, a negative one a decrease, and zero means no change.
Input
The only line contains two real numbers: initial value and new value .
Output
Print the relative change as a percentage with exactly 2 decimal places and a trailing %.
Subtasks
- Subtask 1 (100 points): and both values are finite.
Examples
Example 1
Input
100 120
Output
20.00%
Explanation. The new-minus-old difference is 20; dividing by the old value 100 and multiplying by gives about 20%. Two-decimal formatting yields 20.00%.
Example 2
Input
80 60
Output
-25.00%
Explanation. The new-minus-old difference is -20; dividing by the old value 80 and multiplying by gives about -25%. Two-decimal formatting yields -25.00%.
Example 3
Input
50 50
Output
0.00%
Explanation. The new-minus-old difference is 0; dividing by the old value 50 and multiplying by gives about 0%. Two-decimal formatting yields 0.00%.