結果

問題 No.1256 連続整数列
ユーザー toshiro_yanagi
提出日時 2022-07-06 09:09:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 712 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,848 KB
実行使用メモリ 149,356 KB
最終ジャッジ日時 2024-12-21 05:32:35
合計ジャッジ時間 12,174 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 WA * 3 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import maxsize

bufio_scanner = []


def main():
    a = int(fmt_scan())
    yes = False
    x, y = 0, 0
    i, j = 0, -1

    while True:
        while True:
            i += 1
            x = i * (i + 1) // 2
            if x - y >= a:
                break
        while True:
            j += 1
            y = j * (j + 1) // 2
            if x - y <= a:
                break
        if i - j <= 1:
            break
        if i - j >= 3 and x - y == a:
            yes = True
            break

    print("YES" if yes else "NO")


def fmt_scan() -> str:
    sc = bufio_scanner
    if len(sc) == 0:
        for v in reversed(input().split()):
            sc.append(v)
    return sc.pop()


main()
0