結果

問題 No.1111 コード進行
ユーザー sca1lsca1l
提出日時 2020-07-19 15:13:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,384 bytes
コンパイル時間 2,309 ms
コンパイル使用メモリ 73,956 KB
実行使用メモリ 61,592 KB
最終ジャッジ日時 2023-08-22 10:00:38
合計ジャッジ時間 25,853 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 304 ms
58,960 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 379 ms
56,404 KB
testcase_19 AC 118 ms
56,076 KB
testcase_20 AC 367 ms
58,580 KB
testcase_21 AC 163 ms
55,716 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 251 ms
56,788 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
    
    static final int MOD = (int)1e9+7;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        
        int[][] complexity = new int[301][301];
        for(int i=0; i<m; i++){
            int p = Integer.parseInt(sc.next());
            int q = Integer.parseInt(sc.next());
            int c = Integer.parseInt(sc.next());
            complexity[p][q] = c;
        }
        
        int[][][] dp = new int[n][301][k+1];
        for(int i=1; i<=300; i++){
            dp[0][i][0] = 1;
        }
        for(int i=1; i<n-1; i++){
            for(int now=1; now<=300; now++){
                for(int j=0; j<k; j++){
                    for(int next=1; next<=300; next++){
                        int sum = j+complexity[now][next];
                        if(sum <= k){
                            dp[i][next][sum] += dp[i-1][now][j];
                            dp[i][next][sum] %= MOD;
                        }
                    }
                }
            }
        }
        
        int ans = 0;
        for(int i=1; i<=300; i++){
            ans += dp[n-2][i][k];
            ans %= MOD;
        }
        
        System.out.println(ans);
    }
}
0