結果

問題 No.1256 連続整数列
ユーザー toshiro_yanagi
提出日時 2022-07-03 21:55:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 518 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2024-11-29 20:23:10
合計ジャッジ時間 34,629 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 WA * 3 TLE * 11
権限があれば一括ダウンロードができます

ソースコード

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) + 1, 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