結果

問題 No.2142 Segment Zero
ユーザー titiatitia
提出日時 2022-12-02 22:22:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 235 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-18 06:42:28
合計ジャッジ時間 13,205 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,880 KB
testcase_01 AC 227 ms
10,752 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 1,170 ms
10,752 KB
testcase_04 AC 1,036 ms
10,752 KB
testcase_05 AC 1,037 ms
10,752 KB
testcase_06 AC 28 ms
10,752 KB
testcase_07 WA -
testcase_08 AC 226 ms
10,752 KB
testcase_09 WA -
testcase_10 AC 255 ms
10,752 KB
testcase_11 AC 229 ms
10,752 KB
testcase_12 AC 254 ms
10,624 KB
testcase_13 AC 244 ms
10,752 KB
testcase_14 AC 255 ms
10,752 KB
testcase_15 AC 259 ms
10,880 KB
testcase_16 AC 256 ms
10,880 KB
testcase_17 AC 202 ms
10,752 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 154 ms
10,752 KB
testcase_21 WA -
testcase_22 AC 174 ms
10,752 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 126 ms
10,752 KB
testcase_29 AC 154 ms
10,752 KB
testcase_30 AC 191 ms
10,752 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 227 ms
10,880 KB
testcase_36 AC 96 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

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