PS/Baekjoon Online Judge

[백준 20737] Sanic [Python]

kimyoungrok 2024. 6. 21. 03:23
728x90

문제

Sanic Hegehog likes to go fast. While Sanic can run, he especially enjoys curling himself up into a ball and rolling really fast downhill through loops. Sanic tries and fails to count the number of rotations he makes while spinning through a loop: spinning so fast makes him dizzy and confused. You, Sanic's faithful sidekick, try to help with the counting but it's futile -- all you see is a blue blur of movement when Sanic rolls around a loop so fast. Perhaps you can write a program to calculate the number of rotations instead?

To simplify things, we measure the world in terms of Sanic radii. While spinning through a loop, Sanic can be accurately modeled as a circle of radius 1. Furthermore, the inside of the loops Sanic spins through can be modeled as circles with radius 𝑟 (measured in Sanic radii).  We also know that  𝑟 will always be at least 1.10 as Sanic does not attempt to spin through smaller loops.  Sanic spins clockwise and he follows the loop counter-clockwise, as illustrated in the diagram.

You need to compute 𝑥, the number of revolutions it takes for Sanic to make exactly one complete lap in the loop. Sanic does not slip - he always has perfect contact with the inside of the loop. The loops are rigid and do not move at all. Remember to go fast and compute the answer quickly!

입력

The input contains a single line with one decimal number 𝑟 the radius of the loop relative to the radius of Sanic.  The number 𝑟 is given in decimal form with exactly two digits and satisfying 1.10≤𝑟≤1000.00.

출력

Print 𝑥, as specified above, with a relative or absolute error of at most 10−6


풀이

Sanic이 반지름이 r인 원의 내부에서 둘레를 따라 자전하며 회전할 때 회전 횟수를 구하는 문제다.

Sanic이 자전하며 형성되는 원의 반지름은 1으로 반지름이 r - 1인 원의 둘레의 길이가 회전 횟수와 일치하게 된다.

즉 회전 횟수는 2 * PI * ( r - 1 )가 된다.


소스코드

보기


출처

https://www.acmicpc.net/problem/20737

728x90