結果

問題 No.2420 Simple Problem
ユーザー Kyoro IDKyoro ID
提出日時 2023-08-12 15:25:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 732 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 45,440 KB
最終ジャッジ日時 2024-04-30 09:15:18
合計ジャッジ時間 30,321 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
12,032 KB
testcase_01 AC 431 ms
25,472 KB
testcase_02 AC 49 ms
12,032 KB
testcase_03 AC 186 ms
17,024 KB
testcase_04 AC 773 ms
38,528 KB
testcase_05 AC 507 ms
28,928 KB
testcase_06 AC 966 ms
45,312 KB
testcase_07 AC 955 ms
45,312 KB
testcase_08 AC 963 ms
45,312 KB
testcase_09 AC 966 ms
45,184 KB
testcase_10 AC 958 ms
45,312 KB
testcase_11 AC 970 ms
45,312 KB
testcase_12 AC 972 ms
45,184 KB
testcase_13 AC 964 ms
45,312 KB
testcase_14 AC 961 ms
45,312 KB
testcase_15 AC 973 ms
45,312 KB
testcase_16 AC 965 ms
45,312 KB
testcase_17 AC 978 ms
45,312 KB
testcase_18 AC 964 ms
45,312 KB
testcase_19 AC 961 ms
45,184 KB
testcase_20 AC 973 ms
45,440 KB
testcase_21 AC 962 ms
45,312 KB
testcase_22 AC 965 ms
45,312 KB
testcase_23 AC 975 ms
45,312 KB
testcase_24 AC 962 ms
45,312 KB
testcase_25 AC 963 ms
45,184 KB
testcase_26 WA -
testcase_27 AC 777 ms
38,656 KB
testcase_28 AC 773 ms
38,656 KB
testcase_29 AC 771 ms
38,656 KB
testcase_30 AC 775 ms
38,656 KB
testcase_31 AC 772 ms
38,656 KB
testcase_32 AC 46 ms
11,904 KB
testcase_33 AC 418 ms
25,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import logging
import math
input = sys.stdin.readline
logger = logging.getLogger(__name__)


def read():
    N = int(input().strip())
    AB = []
    for i in range(N):
        a, b = map(int, input().strip().split())
        AB.append((a, b))
    return N, AB


def solve(N, AB):
    for a, b in AB:
        v = math.floor(math.sqrt(a) + math.sqrt(b))
        xs = [v-2, v-1, v, v+1, v+2]

        left = a * b * 4
        for x_i in xs:
            right = (x_i * x_i - a - b) ** 2
            if left < right:
                ans = x_i
                break
        print(ans)


if __name__ == "__main__":
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))
0