結果

問題 No.648  お や す み 
ユーザー firecat_5053
提出日時 2018-05-11 21:21:29
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-13 22:19:17
合計ジャッジ時間 4,779 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
n = int(input())
t = (1 + math.sqrt(1 + 8 * n)) / 2
case_1 = int(t) - 1
case_2 = int(t)
case_3 = int(t) + 1
if case_1 * (case_1 + 1) == 2 * n:
    print("YES")
    print(case_1)
elif case_2 * (case_2 + 1) == 2 * n:
    print("YES")
    print(case_2)
elif case_3 * (case_3 + 1) == 2 * n:
    print("YES")
    print(case_3)
else:
    print("NO")
0