結果

問題 No.2142 Segment Zero
ユーザー titiatitia
提出日時 2022-12-02 22:36:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 243 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 76,596 KB
最終ジャッジ日時 2023-07-31 06:26:17
合計ジャッジ時間 5,043 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,604 KB
testcase_01 AC 74 ms
75,788 KB
testcase_02 AC 70 ms
71,184 KB
testcase_03 AC 104 ms
76,228 KB
testcase_04 AC 100 ms
76,456 KB
testcase_05 AC 102 ms
76,308 KB
testcase_06 AC 69 ms
71,236 KB
testcase_07 AC 99 ms
76,484 KB
testcase_08 AC 78 ms
76,312 KB
testcase_09 AC 91 ms
76,316 KB
testcase_10 AC 79 ms
76,596 KB
testcase_11 AC 78 ms
76,512 KB
testcase_12 AC 78 ms
76,572 KB
testcase_13 AC 81 ms
76,360 KB
testcase_14 AC 78 ms
76,536 KB
testcase_15 AC 80 ms
76,260 KB
testcase_16 AC 80 ms
76,460 KB
testcase_17 AC 80 ms
76,364 KB
testcase_18 AC 86 ms
76,592 KB
testcase_19 AC 82 ms
76,388 KB
testcase_20 AC 76 ms
75,724 KB
testcase_21 AC 89 ms
76,544 KB
testcase_22 AC 74 ms
75,724 KB
testcase_23 AC 73 ms
75,644 KB
testcase_24 AC 75 ms
76,156 KB
testcase_25 AC 81 ms
76,436 KB
testcase_26 AC 87 ms
76,344 KB
testcase_27 AC 94 ms
76,492 KB
testcase_28 AC 78 ms
76,144 KB
testcase_29 AC 79 ms
76,336 KB
testcase_30 AC 80 ms
76,456 KB
testcase_31 AC 96 ms
76,596 KB
testcase_32 AC 81 ms
76,296 KB
testcase_33 AC 75 ms
76,580 KB
testcase_34 AC 81 ms
76,388 KB
testcase_35 AC 79 ms
76,508 KB
testcase_36 AC 76 ms
76,504 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+8*rest))/2)
    if x*(x+1)==rest*2 and x<i:
        ANS=1

    SUM+=i

print(ANS)
0