結果

問題 No.648  お や す み 
ユーザー tmsausa
提出日時 2018-04-12 13:45:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 272 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 82,648 KB
実行使用メモリ 89,068 KB
最終ジャッジ日時 2024-06-26 21:24:02
合計ジャッジ時間 6,627 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 83
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())

s, t = 1, int(2e9)

def f(x):
    return x * (x + 1) /2

while(s + 1 != t):
    x = (s + t) // 2
    f_x = f(x)
    if f_x == n:
        print("YES")
        print(x)
    elif f_x > n:
        t = x + 1
    else:
        s = x -1
print("NO")
0