6 kyu

Ball Upwards

2,214 of 8,241g964

Description:

You throw a ball vertically upwards with an initial speed v0 (in km per hour).

The height h of the ball at each time t is given by   h=v0t0.5gtt  \; h = v_0 \cdot t - 0.5 \cdot g \cdot t \cdot t \;, where g is the Earth's gravity (g9.81m/s2)( g \approx 9.81 \, m/s^2 ).

A device is recording at every tenth of second the height of the ball.

For example, with v0 = 15 km/h, the device gets something of the following form: (0, 0.0), (1, 0.367...), (2, 0.637...), (3, 0.808...), (4, 0.881..) ... where the first number is the time in tenths of a second and the second number the height in meter.

Task

Write a function with a parameter v0 (in km per hour) that returns the time in tenth of second of the maximum height recorded by the device.

Examples

Given initial speed v0 = 15 --> should return 4

Given initial speed v0 = 25 --> should return 7

Notes

  • Remember to convert the velocity from km/h to m/s or from m/s to km/h when necessary.
  • The maximum height recorded by the device is not necessarily the maximum height reached by the ball.
Fundamentals

More By Author:

Check out these other kata created by g964

Stats:

CreatedDec 12, 2015
PublishedDec 12, 2015
Warriors Trained27247
Total Skips7662
Total Code Submissions43237
Total Times Completed8241
Python Completions2214
JavaScript Completions1427
Java Completions780
C# Completions370
CoffeeScript Completions14
Haskell Completions123
Clojure Completions60
Ruby Completions156
Elixir Completions116
TypeScript Completions168
C++ Completions772
PHP Completions207
Crystal Completions15
F# Completions62
C Completions445
OCaml Completions52
Rust Completions312
Swift Completions188
Go Completions368
Shell Completions74
R Completions75
Nim Completions23
Objective-C Completions26
Kotlin Completions171
Fortran Completions26
Julia Completions39
NASM Completions21
Scala Completions129
PowerShell Completions37
Reason Completions11
Racket Completions32
Forth Completions15
Prolog Completions18
Haxe Completions9
CommonLisp Completions100
Dart Completions119
Pascal Completions15
Raku Completions7
Lua Completions40
Perl Completions14
COBOL Completions10
Elm Completions6
D Completions9
Erlang Completions8
Total Stars405
% of votes with a positive feedback rating79% of 1182
Total "Very Satisfied" Votes800
Total "Somewhat Satisfied" Votes268
Total "Not Satisfied" Votes114
Ad
Contributors
  • g964 Avatar
  • jhoffner Avatar
  • myjinxin2015 Avatar
  • donaldsebleung Avatar
  • imjasonmiller Avatar
  • kazk Avatar
  • FArekkusu Avatar
  • monadius Avatar
  • hobovsky Avatar
  • solitude Avatar
  • trashy_incel Avatar
  • user8436785 Avatar
  • akar-0 Avatar
  • Just4FunCoder Avatar
Ad