結果
問題 |
No.2420 Simple Problem
|
ユーザー |
![]() |
提出日時 | 2025-03-31 17:31:33 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 327 ms / 2,000 ms |
コード長 | 576 bytes |
コンパイル時間 | 193 ms |
コンパイル使用メモリ | 82,620 KB |
実行使用メモリ | 139,820 KB |
最終ジャッジ日時 | 2025-03-31 17:32:22 |
合計ジャッジ時間 | 12,283 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 33 |
ソースコード
import math import sys def main(): input = sys.stdin.read().split() n = int(input[0]) idx = 1 for _ in range(n): a = int(input[idx]) b = int(input[idx + 1]) idx += 2 sqrt_a = math.isqrt(a) a_square = (sqrt_a * sqrt_a == a) sqrt_b = math.isqrt(b) b_square = (sqrt_b * sqrt_b == b) if a_square and b_square: print(sqrt_a + sqrt_b + 1) else: s = math.sqrt(a) + math.sqrt(b) print(math.ceil(s)) if __name__ == '__main__': main()