結果
問題 |
No.472 平均順位
|
ユーザー |
![]() |
提出日時 | 2018-06-05 10:41:05 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 1,071 ms / 2,000 ms |
コード長 | 563 bytes |
コンパイル時間 | 12,061 ms |
コンパイル使用メモリ | 440,224 KB |
実行使用メモリ | 87,740 KB |
最終ジャッジ日時 | 2024-11-20 16:07:58 |
合計ジャッジ時間 | 23,654 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^
ソースコード
import java.util.* fun main(args: Array<String>) { val sc = Scanner(System.`in`) val (N, P) = Pair(sc.nextInt(), sc.nextInt()) val q = Array(N, { arrayOf(sc.nextInt(), sc.nextInt(), sc.nextInt() )}) val inf = 100000L*N val dp = Array(P+4, { i -> if (i == 3) 0L else inf }) for (i in 0 until N) { for (dest in Math.min(3*i+6, P+3) downTo 3) { dp[dest] = Math.min(Math.min(Math.min(dp[dest]+q[i][0], dp[dest-1]+q[i][1]), dp[dest-2]+q[i][2]), dp[dest-3]+1) } } println(dp[P+3].toDouble() / N.toDouble()) }