4 kyu

One Line Task: Squirrel And Tree

859 of 2,319myjinxin2015

Description:

Task

Since the weather was good, some students decided to go for a walk in the park after the first lectures of the new academic year. There they saw a squirrel, which climbed a tree in a spiral at a constant angle to the ground. They calculated that in one loop the squirrel climbes h meters (vertical height), the height of the tree is equal to H (v in Ruby), and the length of its circumference equals S.

These calculations were exhausting, so now the students need your help to figure out how many meters the path length of squirrel climbed when it reached the tree top. The result should be rounded to 4 decimal places.

Code Limit

Less than 52 characters (JavaScript & Python)

Less than 48 characters (Ruby)

Example

For h = 4, H = 16, S = 3, the output should be 20.

For h = 8, H = 9, S = 37, the output should be 42.5869.

Puzzles
Restricted

Stats:

CreatedApr 27, 2017
PublishedApr 27, 2017
Warriors Trained7102
Total Skips2405
Total Code Submissions20297
Total Times Completed2319
JavaScript Completions859
Ruby Completions129
Python Completions1420
Total Stars155
% of votes with a positive feedback rating90% of 453
Total "Very Satisfied" Votes384
Total "Somewhat Satisfied" Votes51
Total "Not Satisfied" Votes18
Total Rank Assessments4
Average Assessed Rank
4 kyu
Highest Assessed Rank
3 kyu
Lowest Assessed Rank
5 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • smile67 Avatar
  • kazk Avatar
  • Firefly2002 Avatar
  • FArekkusu Avatar
  • user9644768 Avatar
Ad