結果

問題 No.648  お や す み 
ユーザー vjudge1
提出日時 2024-05-09 17:43:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 290 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2024-12-16 08:46:20
合計ジャッジ時間 6,114 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

def sleep(n):
    i = 0
    j = n
    while i < j - 1:
        m = (i + j) // 2
        if m * (m + 1) // 2 >= n:
            j = m
        else:
            i = m
    if j * (j + 1) // 2 == n:
        print("YES")
        print(j)
    else:
        print("NO")


n = int(input())
sleep(n)
0