結果

問題 No.2142 Segment Zero
ユーザー titiatitia
提出日時 2022-12-02 22:22:18
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 235 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-09 23:54:06
合計ジャッジ時間 13,656 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt

N,K=map(int,input().split())

SUM=0
ANS=2
for i in range(N,-1,-1):
    rest=K-SUM
    if rest<0:
        continue

    x=round((-1+sqrt(1+9*rest))/2)
    if x*(x+1)==rest*2:
        ANS=1

    SUM+=i

print(ANS)
0