結果

問題 No.2420 Simple Problem
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-08-23 06:47:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,175 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 104,540 KB
最終ジャッジ日時 2023-12-25 16:00:56
合計ジャッジ時間 38,841 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 531 ms
87,012 KB
testcase_02 AC 74 ms
75,868 KB
testcase_03 AC 239 ms
79,708 KB
testcase_04 AC 946 ms
98,396 KB
testcase_05 AC 633 ms
89,816 KB
testcase_06 AC 1,173 ms
104,412 KB
testcase_07 AC 1,162 ms
104,412 KB
testcase_08 AC 1,152 ms
104,412 KB
testcase_09 AC 1,158 ms
104,412 KB
testcase_10 AC 1,172 ms
104,412 KB
testcase_11 AC 1,152 ms
104,412 KB
testcase_12 AC 1,167 ms
104,412 KB
testcase_13 AC 1,162 ms
104,540 KB
testcase_14 AC 1,170 ms
104,536 KB
testcase_15 AC 1,155 ms
104,412 KB
testcase_16 AC 1,155 ms
104,540 KB
testcase_17 AC 1,174 ms
104,412 KB
testcase_18 AC 1,159 ms
104,540 KB
testcase_19 AC 1,172 ms
104,540 KB
testcase_20 AC 1,160 ms
104,412 KB
testcase_21 AC 1,173 ms
104,408 KB
testcase_22 AC 1,175 ms
104,408 KB
testcase_23 AC 1,165 ms
104,412 KB
testcase_24 AC 1,155 ms
104,540 KB
testcase_25 AC 1,158 ms
104,412 KB
testcase_26 AC 39 ms
53,460 KB
testcase_27 AC 994 ms
98,524 KB
testcase_28 AC 1,011 ms
98,520 KB
testcase_29 AC 1,014 ms
98,520 KB
testcase_30 AC 1,008 ms
98,392 KB
testcase_31 AC 995 ms
98,396 KB
testcase_32 AC 37 ms
53,460 KB
testcase_33 AC 505 ms
86,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# A+2ab+B<X^2
# 2ab < (X^2-A-B)
# 4AB < (X^2-A-B)^2

N = int(input())
ANS = []
for i in range(N):
	
	A,B = map(int,input().split())
	l = 0
	r = 10**6
	while r-l != 1:
		m = (l+r)//2
		if m**2-A-B > 0 and 4*A*B < (m**2-A-B)**2:
			r = m
		else:
			l = m
	ANS.append(r)
print (*ANS,sep="\n")
0