結果

問題 No.48 ロボットの操縦
ユーザー komkomhkomkomh
提出日時 2019-04-20 09:16:49
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 305 ms / 5,000 ms
コード長 516 bytes
コンパイル時間 11,236 ms
コンパイル使用メモリ 424,680 KB
実行使用メモリ 54,416 KB
最終ジャッジ日時 2024-04-30 20:22:08
合計ジャッジ時間 19,947 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 304 ms
54,416 KB
testcase_01 AC 299 ms
54,176 KB
testcase_02 AC 298 ms
54,116 KB
testcase_03 AC 303 ms
54,228 KB
testcase_04 AC 299 ms
54,180 KB
testcase_05 AC 295 ms
54,196 KB
testcase_06 AC 300 ms
54,108 KB
testcase_07 AC 297 ms
54,416 KB
testcase_08 AC 300 ms
54,168 KB
testcase_09 AC 300 ms
54,316 KB
testcase_10 AC 300 ms
54,044 KB
testcase_11 AC 295 ms
54,120 KB
testcase_12 AC 299 ms
54,308 KB
testcase_13 AC 298 ms
54,100 KB
testcase_14 AC 295 ms
54,216 KB
testcase_15 AC 299 ms
54,104 KB
testcase_16 AC 301 ms
54,308 KB
testcase_17 AC 296 ms
54,152 KB
testcase_18 AC 295 ms
54,176 KB
testcase_19 AC 297 ms
54,324 KB
testcase_20 AC 295 ms
54,296 KB
testcase_21 AC 298 ms
54,312 KB
testcase_22 AC 299 ms
54,284 KB
testcase_23 AC 296 ms
54,176 KB
testcase_24 AC 305 ms
54,096 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