309722: CF1725G. Garage

Memory Limit:128 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Garage

题意翻译

给出$N$,请求出$b^2 - a ^ 2$的第$N$小值,其中$a, b \in \mathbb{N}^+$

题目描述

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. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1725G/7e485d3e8037daefec2b8ca00b8b11546f3e5f77.png)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<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.

输入输出格式

输入格式


The only line contains a single integer $ N $ ( $ 1 \leq N \leq 10^9 $ ).

输出格式


An integer that represents the $ N $ -th smallest suitable number.

输入输出样例

输入样例 #1

3

输出样例 #1

7

说明

The $ 3 $ -rd smallest suitable number is $ 7 $ . A square area of $ 7 $ can be obtained by assigning $ a=3 $ and $ b=4 $ .

Input

题意翻译

给出$N$,请求出$b^2 - a ^ 2$的第$N$小值,其中$a, b \in \mathbb{N}^+$

Output

题目大意:
Pak Chanek想要建造一个车库,由一个正方形和一个直角三角形组成,形状如题目描述中的插图所示。定义直角三角形的两条直角边长度分别为a和b。一个整数x是合适的,当且仅当我们可以构造一个车库,并为长度a和b分配正整数值(a
输入输出格式:
输入格式:
只有一行,包含一个整数N(1≤N≤10^9)。

输出格式:
一个整数,代表第N个最小的合适数。

输入输出样例:
输入样例 #1:
3
输出样例 #1:
7

说明:
第3个最小的合适数是7。可以通过分配a=3和b=4来获得面积为7的正方形。题目大意: Pak Chanek想要建造一个车库,由一个正方形和一个直角三角形组成,形状如题目描述中的插图所示。定义直角三角形的两条直角边长度分别为a和b。一个整数x是合适的,当且仅当我们可以构造一个车库,并为长度a和b分配正整数值(a

加入题单

算法标签: