結果

問題 No.419 直角三角形
ユーザー yozayoza
提出日時 2016-09-09 23:04:14
言語 Ruby
(3.3.0)
結果
AC  
実行時間 80 ms / 1,000 ms
コード長 165 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 11,324 KB
実行使用メモリ 15,708 KB
最終ジャッジ日時 2023-08-10 09:07:46
合計ジャッジ時間 3,004 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,552 KB
testcase_01 AC 74 ms
15,440 KB
testcase_02 AC 73 ms
15,400 KB
testcase_03 AC 72 ms
15,408 KB
testcase_04 AC 72 ms
15,616 KB
testcase_05 AC 75 ms
15,468 KB
testcase_06 AC 74 ms
15,460 KB
testcase_07 AC 73 ms
15,568 KB
testcase_08 AC 72 ms
15,520 KB
testcase_09 AC 75 ms
15,592 KB
testcase_10 AC 75 ms
15,636 KB
testcase_11 AC 73 ms
15,456 KB
testcase_12 AC 72 ms
15,472 KB
testcase_13 AC 74 ms
15,628 KB
testcase_14 AC 79 ms
15,412 KB
testcase_15 AC 77 ms
15,552 KB
testcase_16 AC 75 ms
15,416 KB
testcase_17 AC 73 ms
15,488 KB
testcase_18 AC 77 ms
15,512 KB
testcase_19 AC 80 ms
15,404 KB
testcase_20 AC 77 ms
15,708 KB
testcase_21 AC 77 ms
15,444 KB
testcase_22 AC 77 ms
15,512 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

sides = gets.split.map(&:to_i)
c = sides.max
a = sides.min

b1 = (c ** 2 - a ** 2) ** 0.5
b2 = (c ** 2 + a ** 2) ** 0.5

if b1 + a > c
  puts b1
else
  puts b2
end

0