Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Sunday 30 October 2016

E. Time for a Little Physics
Problem link
https://algo.codemarshal.org/contests/diu-122-fl16-termwork/problems/E

Score: 1

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 ua and t.

Input

3 double variables in a line denoting uat respectively.

Output

The value of s, printed two digits after the decimal point.

Sample

InputOutput
10.00 2.20 5.5388.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