問題一覧 > 通常問題

No.2746 Bicolor Pyramid

レベル : / AI推定難易度 : 2000 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 22
作問者 : Nzt3 / テスター : ponjuice kenken714 cho435 tassei903
お気に入りにしたユーザー ProblemId : 10838 / 自分の提出
問題文最終更新日: 2024-04-19 15:21:48
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もしくは右上の雲マークをクリックしてアカウントを作成してください。