結果

問題 No.1256 連続整数列
ユーザー toshiro_yanagi
提出日時 2022-07-03 21:57:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 519 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 577,472 KB
最終ジャッジ日時 2024-11-29 20:26:16
合計ジャッジ時間 22,353 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 WA * 1 TLE * 3 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

bufio_scanner = []


def main():
    a = int(fmt_scan())
    s = 0
    ans = "NO"
    q = deque()
    for i in range(int(a / 3) + 10, 0, -1):
        q.append(i)
        s += i
        if s > a:
            s -= q.popleft()
        if s == a:
            ans = "YES"
            break
    print(ans)


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


main()
0