#include <iostream>
#include <math.h>
using namespace std;
int main()
{
//Variables
double acceleration = 9.8;
double velocity_final = 0;
double velocity_initial = 0;
double distance = 0;
double height_of_floor = 0;
double time = 0;
int number_of_floors = 0;
//Initialize data
cout << "How many floors in the building?" << endl;
cin >> number_of_floors;
cout << "What is the height of a floor?" << endl;
cin >> height_of_floor;
//Any item with no air resistance will drop at a constant 9.8 meters per second times second.
//So if we know the distance of the fall then we can compute the time by setting both equations
//equal to each-other as we already know the acceleration!
//Distance is number_of_floors times height_of_floor
//acceleration = (velocity_final - 0) / time so that we get:
//acceleration = velocity_final / time which means that:
//velocity_final = acceleration*time
distance = number_of_floors*height_of_floor;
time = sqrtf(2*distance/acceleration);
velocity_final = acceleration*time;
cout << "The balloon takes " << time << " s to hit the floor." << endl;
cout << "The final velocity of the balloon is " << velocity_final << " m/s." << endl;
return 0;
}