結果

問題 No.1111 コード進行
ユーザー sca1lsca1l
提出日時 2020-07-19 15:07:40
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,376 bytes
コンパイル時間 3,981 ms
コンパイル使用メモリ 79,560 KB
実行使用メモリ 75,916 KB
最終ジャッジ日時 2023-08-22 10:00:09
合計ジャッジ時間 19,343 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
56,456 KB
testcase_01 AC 112 ms
55,828 KB
testcase_02 AC 112 ms
56,204 KB
testcase_03 AC 113 ms
55,792 KB
testcase_04 AC 113 ms
55,244 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 215 ms
58,808 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 180 ms
56,296 KB
testcase_14 WA -
testcase_15 AC 156 ms
56,024 KB
testcase_16 WA -
testcase_17 AC 146 ms
56,880 KB
testcase_18 AC 121 ms
55,844 KB
testcase_19 AC 116 ms
55,692 KB
testcase_20 AC 165 ms
55,924 KB
testcase_21 AC 138 ms
56,108 KB
testcase_22 AC 162 ms
55,892 KB
testcase_23 WA -
testcase_24 AC 182 ms
56,148 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 178 ms
56,708 KB
testcase_28 AC 161 ms
58,232 KB
testcase_29 AC 194 ms
58,716 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 TLE -
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][m+1][k+1];
        for(int i=1; i<=m; i++){
            dp[0][i][0] = 1;
        }
        for(int i=1; i<n-1; i++){
            for(int now=1; now<=m; now++){
                for(int j=0; j<k; j++){
                    for(int next=1; next<=m; 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<=m; i++){
            ans += dp[n-2][i][k];
            ans %= MOD;
        }
        
        System.out.println(ans);
    }
}
0