No.648 G o o d N i g h t
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もしくは右上の雲マークをクリックしてアカウントを作成してください。
はむこ