結果

問題 No.498 ワープクリスタル (給料日編)
ユーザー kuuso1kuuso1
提出日時 2017-03-24 23:36:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 2,158 bytes
コンパイル時間 4,962 ms
コンパイル使用メモリ 107,664 KB
実行使用メモリ 22,832 KB
最終ジャッジ日時 2023-09-20 04:30:40
合計ジャッジ時間 7,394 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,912 KB
testcase_01 AC 59 ms
22,652 KB
testcase_02 AC 59 ms
22,676 KB
testcase_03 AC 59 ms
20,612 KB
testcase_04 AC 68 ms
20,680 KB
testcase_05 AC 58 ms
20,652 KB
testcase_06 AC 67 ms
20,852 KB
testcase_07 AC 68 ms
20,856 KB
testcase_08 AC 69 ms
20,636 KB
testcase_09 AC 67 ms
20,800 KB
testcase_10 AC 58 ms
18,640 KB
testcase_11 AC 59 ms
22,680 KB
testcase_12 AC 58 ms
20,612 KB
testcase_13 AC 59 ms
20,632 KB
testcase_14 AC 58 ms
22,704 KB
testcase_15 AC 59 ms
20,604 KB
testcase_16 AC 59 ms
20,596 KB
testcase_17 AC 57 ms
20,800 KB
testcase_18 AC 66 ms
18,748 KB
testcase_19 AC 68 ms
20,596 KB
testcase_20 AC 69 ms
22,708 KB
testcase_21 AC 68 ms
20,588 KB
testcase_22 AC 68 ms
22,832 KB
testcase_23 AC 68 ms
22,684 KB
testcase_24 AC 68 ms
18,584 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long mod = (long)1e9+7;
		long[][] C = new long[100][];
		for(int i=0;i<100;i++) C[i] = new long[100];
		C[0][0] = 1;
		for(int i=1;i<100;i++){
			C[i][0] = 1;
			for(int j=1;j<=i;j++){
				C[i][j] = C[i-1][j] + C[i-1][j-1];
				if(C[i][j] >= mod) C[i][j] -= mod;
			}
		}
		long ans = 0;
		for(int a=0;a<=N[0];a++){
			for(int b=0;b<=N[1];b++){
				for(int c=0;c<=N[2];c++){
					for(int d=0;d<=N[3];d++){
						for(int e=0;e<=N[4];e++){
							var tot = a + b + c + d + e;
							var xt = X[0]*a + X[1]*b + X[2]*c + X[3]*d + X[4]*e;
							var yt = Y[0]*a + Y[1]*b + Y[2]*c + Y[3]*d + Y[4]*e;
							if(xt != Gx || yt != Gy) continue;
							long m = 1;
							m *= C[tot][a]; tot -= a; if(m >= mod) m %= mod;
							m *= C[tot][b]; tot -= b; if(m >= mod) m %= mod;
							m *= C[tot][c]; tot -= c; if(m >= mod) m %= mod;
							m *= C[tot][d]; tot -= d; if(m >= mod) m %= mod;
							m *= C[tot][e]; tot -= e; if(m >= mod) m %= mod;
							
							ans += m; if(ans >= mod) ans -= mod;
						}
					}
				}
			}
		}
		
		
		Console.WriteLine(ans);
		
		
	}
	int Gx,Gy,K;
	int[] X,Y,N;
	public Sol(){
		var d = ria();
		Gx = d[0]; Gy = d[1]; K = d[2];
		X = new int[5];
		Y = new int[5];
		N = new int[5];
		for(int i=0;i<K;i++){
			d = ria();
			X[i] = d[0]; Y[i] = d[1]; N[i] = d[2];
		}
		K = 5;
	}

	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(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0