codeforces-scrape

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

1725G.md (1150B)


      1 Source: https://codeforces.com/problemset/problem/1725/G
      2 
      3 G. Garage
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 128 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Pak Chanek plans to build a garage. He wants the garage to consist of a square and a right triangle that are arranged like the following illustration.
     22 
     23  ![](https://espresso.codeforces.com/33165bb6331f36414f00db733c1463a3e53d7e6e.png) 
     24 
     25 Define $a$ and $b$ as the lengths of two of the sides in the right triangle as shown in the illustration. An integer $x$ is suitable if and only if we can construct a garage with assigning positive integer values for the lengths $a$ and $b$ ($a \lt b$) so that the area of the square at the bottom is exactly $x$. As a good friend of Pak Chanek, you are asked to help him find the $N$-th smallest suitable number.
     26 
     27 Input
     28 
     29 The only line contains a single integer $N$ ($1 \leq N \leq 10^9$).
     30 
     31 Output
     32 
     33 An integer that represents the $N$-th smallest suitable number.
     34 
     35 Example
     36 
     37 Input
     38 
     39 ```
     40 3
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 7
     47 ```
     48 
     49 Note
     50 
     51 The $3$-rd smallest suitable number is $7$. A square area of $7$ can be obtained by assigning $a=3$ and $b=4$.