結果

問題 No.48 ロボットの操縦
ユーザー komkomhkomkomh
提出日時 2019-04-20 09:16:49
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 272 ms / 5,000 ms
コード長 516 bytes
コンパイル時間 11,332 ms
コンパイル使用メモリ 411,936 KB
実行使用メモリ 50,528 KB
最終ジャッジ日時 2023-08-13 01:48:49
合計ジャッジ時間 19,577 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 264 ms
50,528 KB
testcase_01 AC 267 ms
50,224 KB
testcase_02 AC 267 ms
50,336 KB
testcase_03 AC 265 ms
50,184 KB
testcase_04 AC 268 ms
50,160 KB
testcase_05 AC 265 ms
50,256 KB
testcase_06 AC 266 ms
49,996 KB
testcase_07 AC 269 ms
50,200 KB
testcase_08 AC 269 ms
50,192 KB
testcase_09 AC 266 ms
50,132 KB
testcase_10 AC 266 ms
50,232 KB
testcase_11 AC 269 ms
50,068 KB
testcase_12 AC 270 ms
50,188 KB
testcase_13 AC 269 ms
50,136 KB
testcase_14 AC 270 ms
50,108 KB
testcase_15 AC 266 ms
50,024 KB
testcase_16 AC 268 ms
50,200 KB
testcase_17 AC 267 ms
50,012 KB
testcase_18 AC 270 ms
50,188 KB
testcase_19 AC 270 ms
50,156 KB
testcase_20 AC 263 ms
50,188 KB
testcase_21 AC 272 ms
50,144 KB
testcase_22 AC 267 ms
50,152 KB
testcase_23 AC 268 ms
50,232 KB
testcase_24 AC 270 ms
50,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder

import kotlin.math.absoluteValue

fun main() {
    val x = readLine()!!.toInt()
    val y = readLine()!!.toInt()
    val l = readLine()!!.toInt()

    var count = 0 // 回数
    if (x != 0) count++
    if (y < 0) count ++
    if (y < 0 && x == 0) count++

    count += y.absoluteValue / l // 高速
    if (y.absoluteValue % l > 0) {
        count++ // 残り
    }
    count += x.absoluteValue / l // 高速
    if (x.absoluteValue % l > 0) {
        count++ // 残り
    }
    println(count)
}
0