結果
| 問題 |
No.1111 コード進行
|
| コンテスト | |
| ユーザー |
sca1l
|
| 提出日時 | 2020-07-19 15:07:40 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,376 bytes |
| コンパイル時間 | 2,111 ms |
| コンパイル使用メモリ | 77,816 KB |
| 実行使用メモリ | 225,316 KB |
| 最終ジャッジ日時 | 2024-12-16 05:52:56 |
| 合計ジャッジ時間 | 46,850 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 WA * 16 TLE * 10 |
ソースコード
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);
}
}
sca1l