結果
問題 |
No.419 直角三角形
|
ユーザー |
![]() |
提出日時 | 2016-12-18 14:14:15 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 337 ms / 1,000 ms |
コード長 | 612 bytes |
コンパイル時間 | 12,084 ms |
コンパイル使用メモリ | 427,920 KB |
実行使用メモリ | 57,972 KB |
最終ジャッジ日時 | 2024-11-20 07:18:11 |
合計ジャッジ時間 | 18,709 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^
ソースコード
fun main(args: Array<String>) { val a_b : List<Int> = readLine()!!.split(" ").map { it.toInt() } val result = java.lang.String.format("%.10f", getThirdSide(a_b)) println(result) } fun getThirdSide(ab : List<Int>) : Double { val a = ab.first().toDouble() val b = ab.last().toDouble() if (a == b) { val c2 = Math.pow(a, 2.0) + Math.pow(b, 2.0) return Math.sqrt(c2) } else if (a > b) { val c2 = Math.pow(a, 2.0) - Math.pow(b, 2.0) return Math.sqrt(c2) } else { val c2 = Math.pow(b, 2.0) - Math.pow(a, 2.0) return Math.sqrt(c2) } }