結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー | takeya_okino |
提出日時 | 2017-07-04 21:06:42 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 696 bytes |
コンパイル時間 | 2,450 ms |
コンパイル使用メモリ | 77,708 KB |
実行使用メモリ | 67,584 KB |
最終ジャッジ日時 | 2024-04-15 16:14:12 |
合計ジャッジ時間 | 6,929 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 135 ms
41,640 KB |
testcase_01 | WA | - |
testcase_02 | AC | 118 ms
40,380 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 131 ms
41,152 KB |
testcase_06 | AC | 136 ms
41,448 KB |
testcase_07 | AC | 214 ms
57,576 KB |
testcase_08 | WA | - |
testcase_09 | AC | 176 ms
52,184 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 171 ms
47,808 KB |
testcase_13 | WA | - |
testcase_14 | AC | 138 ms
42,004 KB |
testcase_15 | WA | - |
testcase_16 | AC | 165 ms
47,880 KB |
testcase_17 | AC | 148 ms
42,572 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { long MOD = (long)Math.pow(10, 9) + 7; Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int S = sc.nextInt(); int K = sc.nextInt(); // dp[i][j]はi人募金した時点で確定金額がj円となる場合の数 long[][] dp = new long[N + 1][S + 1]; dp[0][0] = 1; for(int i = 1; i < N + 1; i++) { for(int j = 0; j < S + 1; j++) { if(j >= K * (N - i + 1)) dp[i][j] = (dp[i][j] + dp[i - 1][j - K * (N - i + 1)]) % MOD; if(j >= (N - i + 1)) dp[i][j] = (dp[i][j] + dp[i][j - (N - i + 1)]) % MOD; } } System.out.println(dp[N][S]); } }