結果

問題 No.2420 Simple Problem
ユーザー NakLon131NakLon131
提出日時 2023-08-12 16:19:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,827 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,112 KB
最終ジャッジ日時 2023-12-30 13:21:27
合計ジャッジ時間 54,193 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 782 ms
76,344 KB
testcase_02 AC 84 ms
75,576 KB
testcase_03 AC 356 ms
76,088 KB
testcase_04 AC 1,488 ms
76,728 KB
testcase_05 AC 922 ms
76,472 KB
testcase_06 AC 1,748 ms
76,984 KB
testcase_07 AC 1,761 ms
76,984 KB
testcase_08 AC 1,753 ms
76,984 KB
testcase_09 AC 1,745 ms
76,984 KB
testcase_10 AC 1,749 ms
76,984 KB
testcase_11 AC 1,746 ms
76,984 KB
testcase_12 AC 1,749 ms
76,984 KB
testcase_13 AC 1,759 ms
76,984 KB
testcase_14 AC 1,737 ms
76,984 KB
testcase_15 AC 1,746 ms
76,984 KB
testcase_16 AC 1,746 ms
76,984 KB
testcase_17 AC 1,774 ms
76,984 KB
testcase_18 AC 1,753 ms
76,984 KB
testcase_19 AC 1,797 ms
76,984 KB
testcase_20 AC 1,827 ms
76,984 KB
testcase_21 AC 1,745 ms
77,112 KB
testcase_22 AC 1,746 ms
76,984 KB
testcase_23 AC 1,747 ms
76,984 KB
testcase_24 AC 1,743 ms
76,984 KB
testcase_25 AC 1,769 ms
76,984 KB
testcase_26 AC 47 ms
59,324 KB
testcase_27 AC 1,524 ms
76,856 KB
testcase_28 AC 1,461 ms
76,856 KB
testcase_29 AC 1,489 ms
76,856 KB
testcase_30 AC 1,500 ms
76,856 KB
testcase_31 AC 1,490 ms
76,856 KB
testcase_32 AC 39 ms
53,460 KB
testcase_33 AC 747 ms
76,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

def solve():
	a, b = map(int, input().split())
	# sqrt(a) + sqrt(b) < x
	# 2 * sqrt(ab) < (x^2-a-b)
	# 4ab < (x^2 - a - b) ^ 2

	l = 0
	r = 10**6
	for i in range(100):
		m = (l + r) // 2

		val = m**2-a-b
		if val < 0 or 4*a*b >= val**2: l = m
		else: r = m
	print(r)

for i in range(n):
	solve()
0