問題一覧 > 通常問題

No.648 G o o d N i g h t

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 359
作問者 : はむこ / テスター : ciel
お気に入りにしたユーザー ProblemId : 1854 / 自分の提出
問題文最終更新日: 2018-10-01 00:19:34
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
yukicoder contest 183 (順位表) の他の問題:

Problem Statement

"1 sheep... 2 sheep..."
At second $i$, $i$ sheep jump over the fence.

Hamuko falls asleep when the number of sheep that have jumped over the fence becomes exactly $n$.
Can Hamuko fall asleep? If so, at which second will she fall asleep?

Input

n

$1\le n \le 2 \times 10^{18}$

Output

If she can fall asleep, print YES on the first line and the number of seconds on the second line.

If she cannot fall asleep, print only NO on the first line.

Sample

Sample 1
Input
10
Output
YES
4

At second $1$, $1$ sheep jumps over the fence. So far, $1$ sheep have jumped over the fence.
At second $2$, $2$ sheep jump over the fence. So far, $3$ sheep have jumped over the fence.
At second $3$, $3$ sheep jump over the fence. So far, $6$ sheep have jumped over the fence.
At second $4$, $4$ sheep jump over the fence. So far, $10$ sheep have jumped over the fence. Good night.

Sample 2
Input
1000000000000000000
Output
NO

$10^{18}$ seconds from now is about $7.6 \times 10^{11} \approx 761035007610$ years from now, but
she cannot fall asleep even $10^{10}$ years from now, when the stars of the universe are said to burn out. Good night, universe.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。