結果

問題 No.2420 Simple Problem
ユーザー miya145592miya145592
提出日時 2023-08-12 14:06:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 449 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 103,936 KB
最終ジャッジ日時 2024-04-30 04:59:42
合計ジャッジ時間 16,870 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,840 KB
testcase_01 AC 234 ms
87,296 KB
testcase_02 AC 75 ms
68,992 KB
testcase_03 AC 147 ms
80,560 KB
testcase_04 AC 370 ms
97,964 KB
testcase_05 AC 269 ms
90,676 KB
testcase_06 AC 432 ms
103,680 KB
testcase_07 AC 432 ms
103,296 KB
testcase_08 AC 433 ms
103,296 KB
testcase_09 AC 440 ms
103,392 KB
testcase_10 AC 438 ms
103,680 KB
testcase_11 AC 438 ms
103,396 KB
testcase_12 AC 437 ms
103,552 KB
testcase_13 AC 440 ms
103,540 KB
testcase_14 AC 436 ms
103,624 KB
testcase_15 AC 435 ms
103,412 KB
testcase_16 AC 434 ms
103,780 KB
testcase_17 AC 435 ms
103,464 KB
testcase_18 AC 435 ms
103,168 KB
testcase_19 AC 435 ms
103,168 KB
testcase_20 AC 437 ms
103,468 KB
testcase_21 AC 449 ms
103,936 KB
testcase_22 AC 441 ms
103,296 KB
testcase_23 AC 447 ms
103,584 KB
testcase_24 AC 438 ms
103,552 KB
testcase_25 AC 444 ms
103,508 KB
testcase_26 AC 42 ms
51,968 KB
testcase_27 AC 375 ms
97,920 KB
testcase_28 AC 378 ms
98,096 KB
testcase_29 AC 382 ms
97,920 KB
testcase_30 AC 381 ms
98,024 KB
testcase_31 AC 378 ms
98,044 KB
testcase_32 AC 40 ms
51,968 KB
testcase_33 AC 236 ms
87,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def isqrt(n):
    if n == 0: return 0
    x = 1 << (n.bit_length() + 1) // 2
    y = (x + n // x) // 2
    while y < x:
        x = y
        y = (x + n // x) // 2
    return x

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
for a, b in AB:
    x = isqrt(a+b+isqrt(4*a*b))
    print(x+1)
0