Is it Physics???
Time Limit: 0.5 sec
The Problem
Sam loves cars and speed. Now she wants to make a program where she can easily calculate the formulas of velocity.
As you know cars have initial velocity (u), final velocity (v), acceleration (a), time (t) and a distance (s).
You will be given any 3 of u, v, a, s or t. You have to find the missing parameter.
The Input
The input file contains several lines. Each line contains 4 integer numbers, N (N<=3) & any 3 of u, v, a, t and s. All are ranged between 0 to 100. Input is terminated by EOF.
The input format is
If N = 1 the input contains u, a, t and find the value of s
If N = 2 the input contains u, a, s and find the value of v
If N = 3 the input contains v, a, s and find the value of u
The Output
For each line of input output will print the value rounded to 3 decimal points in a separate line.
Sample Input
1 10 5 2
2 10 11 2
3 5 1 6
Sample Output
30.000
12.000
3.606
Online Mock Contest 2016
Problem Setter: Samia Safa Ahmed