結果
問題 | No.48 ロボットの操縦 |
ユーザー | yo-kondo |
提出日時 | 2018-03-24 21:00:30 |
言語 | Kotlin (1.9.23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,155 bytes |
コンパイル時間 | 14,698 ms |
コンパイル使用メモリ | 437,104 KB |
実行使用メモリ | 54,504 KB |
最終ジャッジ日時 | 2024-04-30 17:25:49 |
合計ジャッジ時間 | 20,191 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 291 ms
54,304 KB |
testcase_01 | AC | 287 ms
54,392 KB |
testcase_02 | AC | 283 ms
54,152 KB |
testcase_03 | WA | - |
testcase_04 | AC | 287 ms
54,340 KB |
testcase_05 | AC | 287 ms
54,248 KB |
testcase_06 | AC | 282 ms
54,276 KB |
testcase_07 | AC | 281 ms
54,180 KB |
testcase_08 | WA | - |
testcase_09 | AC | 286 ms
54,372 KB |
testcase_10 | WA | - |
testcase_11 | AC | 287 ms
54,160 KB |
testcase_12 | AC | 285 ms
54,172 KB |
testcase_13 | AC | 281 ms
54,396 KB |
testcase_14 | AC | 282 ms
54,388 KB |
testcase_15 | AC | 279 ms
54,264 KB |
testcase_16 | AC | 278 ms
54,200 KB |
testcase_17 | AC | 283 ms
54,096 KB |
testcase_18 | WA | - |
testcase_19 | AC | 287 ms
54,396 KB |
testcase_20 | AC | 284 ms
54,316 KB |
testcase_21 | AC | 284 ms
54,220 KB |
testcase_22 | WA | - |
testcase_23 | AC | 284 ms
54,232 KB |
testcase_24 | WA | - |
コンパイルメッセージ
Main.kt:10:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^
ソースコード
package yukicoder.no48 import kotlin.math.abs import kotlin.math.ceil /** * エントリポイント * @param args コマンドライン引数 */ fun main(args: Array<String>) { val in1 = readLine() val in2 = readLine() val in3 = readLine() println(moveRobot(in1, in2, in3)) } /** * 目的地まで何命令で到達できるかを返します。 * @param eastWest 目的地の東西方向 * @param northSouth 目的地の南北方向 * @param maxDistance ロボットが1命令につき前進することができる最大の距離 */ fun moveRobot(eastWest: String?, northSouth: String?, maxDistance: String?): String { if (eastWest == null || northSouth == null || maxDistance == null) { return "" } var num = 0 val ew = eastWest.toDouble() val ns = northSouth.toDouble() val md = maxDistance.toInt() // 南北 if (ns < 0) { num += 2 num += ceil(abs(ns / md)).toInt() } else if (ns > 0) { num += ceil(abs(ns / md)).toInt() } // 東西 if (ew != 0.0) { num++ num += ceil(abs(ew / md)).toInt() } return num.toString() }