eolymp
bolt
Try our new interface for solving problems
Məsələlər

Spirograph

Spirograph

Some of you might have seen instruments like the figure below. \includegraphics{https://static.e-olymp.com/content/be/be775c47e7c0e1f0745392397220a71d48108030.jpg} Figure 1: Spirograph There are a fixed circle (indicated by \textbf{A} in the figure) and a smaller interior circle with some pinholes (indicated by \textbf{B}). By putting a pen point through one of the pinholes and then rolling the circle \textbf{B} without slipping around the inside of the circle \textbf{A}, we can draw curves as illustrated below. Such curves are called hypotrochoids. \includegraphics{https://static.e-olymp.com/content/ee/eee14894cd7c5ca86d59292cfddbc3d4fe1dbeb4.jpg} Figure 2: An Example Hypotrochoid Your task is to write a program that calculates the length of hypotrochoid, given the radius of the fixed circle \textbf{A}, the radius of the interior circle \textbf{B}, and the distance between the \textbf{B}’s centroid and the used pinhole. \InputFile The input consists of multiple test cases. Each test case is described by a single line in which three integers \textbf{P}, \textbf{Q} and\textbf{R} appear in this order, where \textbf{P} is the radius of the fixed circle \textbf{A}, \textbf{Q} is the radius of the interior circle \textbf{B}, and \textbf{R} is the distance between the centroid of the circle \textbf{B} and the pinhole. You can assume that \textbf{0} ≤ \textbf{R} < \textbf{Q} < \textbf{P} ≤ \textbf{1000}. \textbf{P}, \textbf{Q}, and \textbf{R}are separated by a single space, while no other spaces appear in the input. The end of input is indicated by a line with \textbf{P = Q = R = 0}. \OutputFile For each test case, output the length of the hypotrochoid curve. The error must be within \textbf{10^\{−2\}} ( = \textbf{0.01}).
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB
Giriş verilənləri #1
3 2 1
3 2 0
0 0 0
Çıxış verilənləri #1
13.36489322
6.28318531
Mənbə ACM-ICPC Japan Alumni Group Summer Camp 2007, Day 2, Tokyo, Japan, 2007-09-23