빗방울

빗방울

숫자를 그에 해당하는 빗방울 소리인 Pling, Plang, Plong으로 변환해요.
빗방울 깊이 파고들기!

함수형 파이프라인, 행렬 곱셈, 매크로를 사용해 미리 계산한 표 기반 풀이, 객체 지향 접근법, Python과 TCL을 모두 인상적으로 활용한 풀이, 그리고 엔터프라이즈 에디션까지 다양한 풀이를 살펴봐요.

지시 사항

Raindrops is a slightly more complex version of the FizzBuzz challenge, a classic interview question.

Your task is to convert a number into its corresponding raindrop sounds.

If a given number:

  • is divisible by 3, add "Pling" to the result.
  • is divisible by 5, add "Plang" to the result.
  • is divisible by 7, add "Plong" to the result.
  • is not divisible by 3, 5, or 7, the result should be the number as a string.

Examples

  • 28 is divisible by 7, but not 3 or 5, so the result would be "Plong".
  • 30 is divisible by 3 and 5, but not 7, so the result would be "PlingPlang".
  • 34 is not divisible by 3, 5, or 7, so the result would be "34".
Note

A common way to test if one number is evenly divisible by another is to compare the remainder or modulus to zero. Most languages provide operators or functions for one (or both) of these.