結果
問題 | No.287 場合の数 |
ユーザー |
![]() |
提出日時 | 2015-12-03 02:11:30 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 5,000 ms |
コード長 | 1,734 bytes |
コンパイル時間 | 1,324 ms |
コンパイル使用メモリ | 108,032 KB |
実行使用メモリ | 17,664 KB |
最終ジャッジ日時 | 2024-11-08 00:07:48 |
合計ジャッジ時間 | 2,371 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; namespace BaainoKazu_CS { class Program { static void Main(string[] args) { Solver sol = new Solver(); sol.Solve(); #if DEBUG Console.ReadLine(); #endif } } class Solver { const int Vn = 8; // 変数の数 int n; ulong[,] dp; // dp[i,s] i番目(1-index)までの変数を使い、和がsとなる組み合わせの数 public void Solve() { dp[0, 0] = 1; for(int i=0; i< Vn; i++) { for(int s=0; s<=6*n; s++) { for(int x=0; x<=n; x++) { if (s + x <= 6 * n) { dp[i + 1, s + x] += dp[i, s]; } } } } Console.WriteLine(dp[Vn,6*n]); } public Solver() { n = ri(); dp = new ulong[Vn+1,6*n+1]; } static String rs() { return Console.ReadLine(); } static int ri() { return int.Parse(Console.ReadLine()); } static long rl() { return long.Parse(Console.ReadLine()); } static double rd() { return double.Parse(Console.ReadLine()); } static String[] rsa() { return Console.ReadLine().Split(' '); } static int[] ria() { return Console.ReadLine().Split(' ').Select(e => int.Parse(e)).ToArray(); } static long[] rla() { return Console.ReadLine().Split(' ').Select(e => long.Parse(e)).ToArray(); } static double[] rda() { return Console.ReadLine().Split(' ').Select(e => double.Parse(e)).ToArray(); } } }