結果

問題 No.648  お や す み 
コンテスト
ユーザー cologne
提出日時 2025-12-02 16:06:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 294 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 82,656 KB
実行使用メモリ 54,216 KB
最終ジャッジ日時 2025-12-02 16:06:41
合計ジャッジ時間 6,096 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
from math import isqrt


def input(): return sys.stdin.readline().rstrip('\n')


def main():
    n = int(input())
    k = isqrt(8 * n + 1) // 2

    if k * (k + 1) // 2 != n:
        print('NO')
    else:
        print('YES')
        print(k)


if __name__ == '__main__':
    main()
0