結果

問題 No.296 n度寝
ユーザー da_louisda_louis
提出日時 2020-02-11 23:53:39
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 333 ms / 1,000 ms
コード長 385 bytes
コンパイル時間 13,350 ms
コンパイル使用メモリ 444,548 KB
実行使用メモリ 54,504 KB
最終ジャッジ日時 2024-04-08 21:31:41
合計ジャッジ時間 19,902 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 330 ms
54,504 KB
testcase_01 AC 328 ms
54,480 KB
testcase_02 AC 323 ms
54,500 KB
testcase_03 AC 319 ms
54,500 KB
testcase_04 AC 324 ms
54,496 KB
testcase_05 AC 327 ms
54,492 KB
testcase_06 AC 326 ms
54,492 KB
testcase_07 AC 329 ms
54,496 KB
testcase_08 AC 320 ms
54,488 KB
testcase_09 AC 326 ms
54,496 KB
testcase_10 AC 324 ms
54,500 KB
testcase_11 AC 327 ms
54,492 KB
testcase_12 AC 327 ms
54,488 KB
testcase_13 AC 329 ms
54,488 KB
testcase_14 AC 332 ms
54,500 KB
testcase_15 AC 333 ms
54,500 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:13:9: warning: 'appendln(Long): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
        appendln(newH)
        ^

ソースコード

diff #

fun main(args: Array<String>) {
    p296()
}

fun p296() {
    val (n, h, m, interval) = readLine()!!.split(' ').map { it.toLong() }

    val add = interval * (n - 1)
    val newH = (h + (add / 60) + (if (m + (add % 60) >= 60) 1 else 0)) % 24
    val newM = (m + (add % 60)) % 60

    val answer = buildString {
        appendln(newH)
        append(newM)
    }

    println(answer)
}
0