No.2746 Bicolor Pyramid
問題文最終更新日: 2024-04-19 15:21:48
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
CPCTF 2024 : PPC
(順位表)
の他の問題:
Problem Statement
There are $R$ red blocks and $B$ blue blocks. You will build a pyramid using these $R+B$ blocks.
The $k$-th level of the pyramid is built using $k^2$ blocks of the same color.
What is the maximum number of levels the pyramid can have?
Constraints
- $1 \leq R,B \leq 10^{18}$
- All inputs are integers.
Input
The input is given from Standard Input in the following format.
$R$ $B$
Output
Output the answer.
Sample
Sample 1
Input
15 15
Output
3
By building levels $1,2$ with red blocks and level $3$ with blue blocks, you can build a pyramid with $3$ levels.
No matter how you use the blocks, you cannot build a pyramid with $4$ or more levels.
Sample 2
Input
1000000000000000000 1000000000000000000
Output
1817120
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。