結果
| 問題 | 
                            No.287 場合の数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             uafr_cs
                         | 
                    
| 提出日時 | 2015-10-12 00:16:20 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 155 ms / 5,000 ms | 
| コード長 | 869 bytes | 
| コンパイル時間 | 2,187 ms | 
| コンパイル使用メモリ | 75,192 KB | 
| 実行使用メモリ | 41,444 KB | 
| 最終ジャッジ日時 | 2024-11-08 00:00:10 | 
| 合計ジャッジ時間 | 6,677 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 22 | 
ソースコード
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		
		final int dp_size = 6 * n;
		long[] DP = new long[dp_size + 1];
		for(int i = 0; i <= n; i++){
			DP[i] = 1;
		}
		
		for(int tt = 0; tt < 3; tt++){
			long[] next_DP = new long[dp_size + 1];
			
			for(int fst = 0; fst <= dp_size; fst++){
				if(DP[fst] == 0){ continue; }
				
				for(int snd = 0; snd <= dp_size - fst; snd++){
					if(DP[snd] == 0){ continue; }
					
					next_DP[fst + snd] += DP[fst] * DP[snd];
				}
			}
			
			//System.out.println(Arrays.toString(DP));
			//System.out.println(Arrays.toString(next_DP));
			
			DP = next_DP;
		}
		
		System.out.println(DP[dp_size]);
		
	}
}
            
            
            
        
            
uafr_cs