結果

問題 No.652 E869120 and TimeZone
ユーザー 💕💖💞
提出日時 2018-06-26 04:51:12
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 337 ms / 1,000 ms
コード長 451 bytes
コンパイル時間 11,766 ms
コンパイル使用メモリ 437,440 KB
実行使用メモリ 52,576 KB
最終ジャッジ日時 2024-06-11 12:26:10
合計ジャッジ時間 24,346 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^
Main.kt:13:27: warning: the expression is unused
  when( m > 0 ) { true -> null; else -> { m += 60; h-=1 } }
                          ^
Main.kt:14:27: warning: the expression is unused
  when( h > 0 ) { true -> null; else -> { h += 24 } }
                          ^

ソースコード

diff #

fun main(args:Array<String>) {
  val (a,b,c) = readLine()!!.split(" ")

  var h = a.toInt()
  var m = b.toInt()
  val delta = c.replace("UTC", "").toDouble() - 9

  h += delta.toInt()
  h = h % 24

  m += Math.round((delta - delta.toInt().toDouble())*60).toInt()

  when( m > 0 ) { true -> null; else -> { m += 60; h-=1 } }
  when( h > 0 ) { true -> null; else -> { h += 24 } }

  h += m/60
  m = m%60

  h = h%24
  println("%02d:%02d".format(h, m))
}
0