結果
| 問題 | No.126 2基のエレベータ |
| コンテスト | |
| ユーザー |
バカらっく
|
| 提出日時 | 2019-10-02 12:02:48 |
| 言語 | Kotlin (2.3.20) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 460 bytes |
| 記録 | |
| コンパイル時間 | 8,494 ms |
| コンパイル使用メモリ | 464,364 KB |
| 実行使用メモリ | 58,932 KB |
| 最終ジャッジ日時 | 2026-04-19 07:37:22 |
| 合計ジャッジ時間 | 16,501 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 2 |
ソースコード
fun main(args:Array<String>) {
val (a,b,s) = readLine()!!.split(" ").map { it.toInt() }
println(getAns(a,b,s))
}
fun getAns(a:Int, b:Int, s:Int):Int {
if(s == 1) {
if(a == 0) {
return 2
} else {
return a
}
}
if(Math.abs(a-s) > Math.abs(b-s)) {
return Math.min(getAns(a, 1, 1) + Math.abs(b-s) + Math.abs(s - 1), Math.abs(b-s) + Math.abs(s-a) + a)
}
return Math.abs(a-s) + s
}
バカらっく