codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1100C.md (1828B)


      1 Source: https://codeforces.com/problemset/problem/1100/C
      2 
      3 C. NN and the Optical Illusion
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 NN is an experienced internet user and that means he spends a lot of time on the social media. Once he found the following image on the Net, which asked him to compare the sizes of inner circles:
     22 
     23  ![](https://espresso.codeforces.com/1ca719fc0c3006021148ccbd15aad647c39f3197.png) 
     24 
     25 It turned out that the circles are equal. NN was very surprised by this fact, so he decided to create a similar picture himself.
     26 
     27 He managed to calculate the number of outer circles $n$ and the radius of the inner circle $r$. NN thinks that, using this information, you can exactly determine the radius of the outer circles $R$ so that the inner circle touches all of the outer ones externally and each pair of neighboring outer circles also touches each other. While NN tried very hard to guess the required radius, he didn't manage to do that.
     28 
     29 Help NN find the required radius for building the required picture.
     30 
     31 Input
     32 
     33 The first and the only line of the input file contains two numbers $n$ and $r$ ($3 \leq n \leq 100$, $1 \leq r \leq 100$) — the number of the outer circles and the radius of the inner circle respectively.
     34 
     35 Output
     36 
     37 Output a single number $R$ — the radius of the outer circle required for building the required picture.
     38 
     39 Your answer will be accepted if its relative or absolute error does not exceed $10^{-6}$.
     40 
     41 Formally, if your answer is $a$ and the jury's answer is $b$. Your answer is accepted if and only when $\frac{|a-b|}{max(1, |b|)} \le 10^{-6}$.
     42 
     43 Examples
     44 
     45 Input
     46 
     47 ```
     48 3 1
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 6.4641016
     55 ```
     56 
     57 Input
     58 
     59 ```
     60 6 1
     61 ```
     62 
     63 Output
     64 
     65 ```
     66 1.0000000
     67 ```
     68 
     69 Input
     70 
     71 ```
     72 100 100
     73 ```
     74 
     75 Output
     76 
     77 ```
     78 3.2429391
     79 ```