結果

問題 No.648  お や す み 
ユーザー Navier_Boltzmann
提出日時 2022-10-22 20:42:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 55,808 KB
最終ジャッジ日時 2024-07-01 20:45:31
合計ジャッジ時間 6,507 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from functools import *
from itertools import *
from heapq import *
import sys,math
input = sys.stdin.readline

n = int(input())


def is_ok(x):
    
    return x*(x+1)//2 >= n
    
y = 10**10
x = 0
while y-x>1:
    mid = (y+x)//2
    if is_ok(mid):
        y = mid
    else:
        x = mid
if y*(y+1)//2==n:
    print('YES')
    print(y)
else:
    print('NO')
0