알고리즘 50 - Beginner Series #4 Cockroach

tamagoyakii·2021년 10월 17일
0

알고리즘

목록 보기
50/89

Q.

The cockroach is one of the fastest insects. Write a function which takes its speed in km per hour and returns it in cm per second, rounded down to the integer (= floored).

For example:

1.08 --> 30
Note! The input is a Real number (actual type is language dependent) and is >= 0. The result should be an Integer.

A)

function cockroachSpeed(s) {
  return Math.floor(s * 100000 / 3600);
}

0개의 댓글