結果

問題 No.2420 Simple Problem
ユーザー redoCtAredoCtA
提出日時 2023-08-12 16:43:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,780 KB
実行使用メモリ 77,456 KB
最終ジャッジ日時 2024-04-30 11:41:35
合計ジャッジ時間 12,381 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,028 KB
testcase_01 AC 156 ms
76,400 KB
testcase_02 AC 54 ms
66,028 KB
testcase_03 AC 93 ms
75,872 KB
testcase_04 AC 254 ms
76,964 KB
testcase_05 AC 179 ms
76,708 KB
testcase_06 AC 302 ms
77,088 KB
testcase_07 AC 297 ms
77,204 KB
testcase_08 AC 298 ms
76,896 KB
testcase_09 AC 297 ms
77,392 KB
testcase_10 AC 298 ms
77,084 KB
testcase_11 AC 299 ms
77,232 KB
testcase_12 AC 297 ms
77,232 KB
testcase_13 AC 299 ms
77,072 KB
testcase_14 AC 300 ms
77,320 KB
testcase_15 AC 296 ms
77,028 KB
testcase_16 AC 301 ms
77,332 KB
testcase_17 AC 296 ms
77,028 KB
testcase_18 AC 309 ms
77,164 KB
testcase_19 AC 301 ms
76,960 KB
testcase_20 AC 295 ms
77,340 KB
testcase_21 AC 304 ms
77,008 KB
testcase_22 AC 299 ms
77,456 KB
testcase_23 AC 299 ms
76,960 KB
testcase_24 AC 302 ms
77,220 KB
testcase_25 AC 297 ms
77,156 KB
testcase_26 AC 38 ms
53,096 KB
testcase_27 AC 247 ms
76,832 KB
testcase_28 AC 249 ms
76,712 KB
testcase_29 AC 252 ms
77,076 KB
testcase_30 AC 246 ms
77,204 KB
testcase_31 AC 247 ms
76,836 KB
testcase_32 AC 38 ms
52,548 KB
testcase_33 AC 153 ms
76,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N = int(input())
    for i in range(N):
        a, b = map(int, input().split())
        X = 0
        ab4 = a*b*4
        for j in range(15, -1, -1):
            x = X+2**j
            if x**2 - a - b <= 0:
                X = x
                continue
            if (x**2-a-b)**2 <= ab4:
                X = x
        print(X+1)
if __name__ == "__main__":
    main()
0