結果
問題 | No.1236 長針と短針 |
ユーザー |
![]() |
提出日時 | 2020-09-26 09:13:22 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 296 ms / 2,000 ms |
コード長 | 877 bytes |
コンパイル時間 | 10,328 ms |
コンパイル使用メモリ | 442,728 KB |
実行使用メモリ | 55,228 KB |
最終ジャッジ日時 | 2024-06-28 18:52:50 |
合計ジャッジ時間 | 17,952 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
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) ^
ソースコード
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()!! }