結果

問題 No.1236 長針と短針
ユーザー rutilicusrutilicus
提出日時 2020-09-26 09:13:22
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 333 ms / 2,000 ms
コード長 877 bytes
コンパイル時間 15,478 ms
コンパイル使用メモリ 423,880 KB
実行使用メモリ 57,084 KB
最終ジャッジ日時 2023-09-11 04:24:22
合計ジャッジ時間 23,124 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 321 ms
56,780 KB
testcase_01 AC 328 ms
56,700 KB
testcase_02 AC 315 ms
56,756 KB
testcase_03 AC 327 ms
56,748 KB
testcase_04 AC 319 ms
56,832 KB
testcase_05 AC 310 ms
56,776 KB
testcase_06 AC 333 ms
56,704 KB
testcase_07 AC 326 ms
56,784 KB
testcase_08 AC 324 ms
56,788 KB
testcase_09 AC 322 ms
56,884 KB
testcase_10 AC 317 ms
56,864 KB
testcase_11 AC 326 ms
56,880 KB
testcase_12 AC 321 ms
56,872 KB
testcase_13 AC 328 ms
56,752 KB
testcase_14 AC 317 ms
57,084 KB
testcase_15 AC 316 ms
56,724 KB
testcase_16 AC 323 ms
56,820 KB
testcase_17 AC 329 ms
56,704 KB
testcase_18 AC 326 ms
56,836 KB
testcase_19 AC 321 ms
56,820 KB
testcase_20 AC 320 ms
56,740 KB
testcase_21 AC 317 ms
56,736 KB
testcase_22 AC 324 ms
56,880 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:42:13: warning: 'appendln(Int): 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.
    builder.appendln(ans)
            ^

ソースコード

diff #

fun main() {
    val builder = StringBuilder()

    val times = listOf(
        Triple(0, 0, 0),
        Triple(1, 5, 27),
        Triple(2, 10, 54),
        Triple(3, 16, 21),
        Triple(4, 21, 49),
        Triple(5, 27, 16),
        Triple(6, 32, 43),
        Triple(7, 38, 10),
        Triple(8, 43, 38),
        Triple(9, 49, 5),
        Triple(10, 54, 32)
    )

    var (a, b) = readInputLine().split(" ").map { it.toInt() }
    var c = 0

    a %= 12

    var ans = 0

    while (true) {
        if (times.contains(Triple(a, b, c))) {
            break
        }
        ans++
        c++
        if (c == 60) {
            b++
            c = 0
        }
        if (b == 60) {
            a++
            a %= 12
            b = 0
        }
    }

    builder.appendln(ans)

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
0