結果

問題 No.498 ワープクリスタル (給料日編)
ユーザー kuuso1
提出日時 2017-03-24 23:36:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 2,158 bytes
コンパイル時間 2,864 ms
コンパイル使用メモリ 107,136 KB
実行使用メモリ 18,176 KB
最終ジャッジ日時 2024-07-06 00:45:21
合計ジャッジ時間 2,500 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
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));}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0