E. Time for a Little Physics
Problem linkhttps://algo.codemarshal.org/contests/diu-122-fl16-termwork/problems/E
Score: 1
CPU: 1s
Memory: 512MB
CPU: 1s
Memory: 512MB
We know from high school physics that s, the distance traveled by a car in t seconds can be determined using the following equation:
s = ut + 0.5at2
where u is the initial velocity and a is the acceleration of the car.
Now you are task is to find the value of s given u, a and t.
Input
3 double variables in a line denoting u, a, t respectively.
Output
The value of s, printed two digits after the decimal point.
Sample
Input | Output |
---|---|
10.00 2.20 5.53 | 88.94 |
Solution
#include<stdio.h> int main() { double u,a,t,s; scanf("%lf%lf%lf",&u,&a,&t); s=(u*t)+(0.5*a*(t*t)); printf("%.2lf\n",s); return 0; }
No comments:
Post a Comment