#PCBBAY0000013. Nội suy tuyến tính (Linear Interpolation)
Nội suy tuyến tính (Linear Interpolation)
Linear Interpolation
Version: Phuoc Hung OJ Extended
Problem Statement
Given endpoints , and a parameter , compute their linear interpolation . The value equals at and at . Print with exactly 6 digits after the decimal point.
Input
The only line contains real endpoints , followed by parameter .
Output
Print interpolated value with exactly 6 decimal places.
Subtasks
- Subtask 1 (100 points): are finite; .
Examples
Example 1
Input
0 10 0.25
Output
2.500000
Explanation. The endpoint difference is 10. Evaluating 0 + (10 - 0) × 0.25 = 2.5 and formatting gives 2.500000.
Example 2
Input
5 9 0.5
Output
7.000000
Explanation. The endpoint difference is 4. Evaluating 5 + (9 - 5) × 0.5 = 7 and formatting gives 7.000000.
Example 3
Input
-10 10 0.75
Output
5.000000
Explanation. The endpoint difference is 20. Evaluating -10 + (10 - -10) × 0.75 = 5 and formatting gives 5.000000.