結果

問題 No.269 見栄っ張りの募金活動
ユーザー yudedakoyudedako
提出日時 2022-01-10 18:53:56
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 342 ms / 5,000 ms
コード長 495 bytes
コンパイル時間 11,420 ms
コンパイル使用メモリ 434,132 KB
実行使用メモリ 55,276 KB
最終ジャッジ日時 2024-04-26 20:15:50
合計ジャッジ時間 20,467 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 314 ms
51,840 KB
testcase_01 AC 301 ms
55,172 KB
testcase_02 AC 288 ms
51,760 KB
testcase_03 AC 304 ms
54,932 KB
testcase_04 AC 317 ms
55,276 KB
testcase_05 AC 308 ms
55,040 KB
testcase_06 AC 304 ms
55,044 KB
testcase_07 AC 342 ms
55,228 KB
testcase_08 AC 303 ms
54,932 KB
testcase_09 AC 289 ms
51,812 KB
testcase_10 AC 317 ms
55,052 KB
testcase_11 AC 316 ms
55,004 KB
testcase_12 AC 292 ms
51,684 KB
testcase_13 AC 313 ms
55,016 KB
testcase_14 AC 296 ms
54,936 KB
testcase_15 AC 318 ms
55,116 KB
testcase_16 AC 293 ms
51,764 KB
testcase_17 AC 289 ms
51,804 KB
testcase_18 AC 311 ms
55,052 KB
testcase_19 AC 309 ms
55,000 KB
testcase_20 AC 300 ms
55,112 KB
testcase_21 AC 294 ms
55,040 KB
testcase_22 AC 324 ms
55,256 KB
testcase_23 AC 302 ms
55,200 KB
testcase_24 AC 311 ms
55,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

const val MOD = 1000000007
fun main() {
    val (n, target, k) = readLine()!!.trim().split(' ').map(String::toInt)
    val initial = n * (n - 1) / 2 * k
    if (initial !in 0 .. target) {
        println(0)
        return
    }
    val memo = IntArray(target - initial + 1).also{it[0] = 1}
    for (i in 0 until n) {
        val rest = n - i
        for (j in 0 .. memo.lastIndex - rest) {
            memo[j + rest] = (memo[j + rest] + memo[j]) % MOD
        }
    }
    println(memo.last())
}
0