結果

問題 No.520 プロジェクトオイラーへの招待
ユーザー 👑 kmjpkmjp
提出日時 2017-05-29 00:02:33
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 285 ms / 4,000 ms
コード長 1,332 bytes
コンパイル時間 1,458 ms
コンパイル使用メモリ 161,736 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 14:50:03
合計ジャッジ時間 2,482 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 87 ms
4,348 KB
testcase_04 AC 96 ms
4,348 KB
testcase_05 AC 285 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll memo[103][103];
ll mo=1000000007;

ll hoge(int A,int B) {
	ll& ret=memo[A][B];
	if(ret>=0) return ret;
	if(A<=1 || B<=1) return 1;
	
	ret=0;
	for(int x=1;x<=B;x++) ret+=hoge(x,A-1);
	ret %= mo;
	return ret;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	int A,B,C;
	
	MINUS(memo);
	cin>>N;
	while(N) {
		N--;
		cin>>A>>B>>C;
		ll ret=0;
		for(i=1;i<=A;i++) for(j=1;j<=B;j++) for(x=1;x<=C;x++) (ret+=hoge(i,j)*hoge(B+1-j,x)%mo*hoge(A+1-i,C+1-x))%=mo;
		for(i=1;i<=A;i++) (ret+=hoge(i,B)*hoge(A+1-i,C+1)%mo)%=mo;
		for(i=1;i<=B;i++) (ret+=hoge(i,A)*hoge(B+1-i,C+1)%mo)%=mo;
		for(i=1;i<=C;i++) (ret+=hoge(i,A)*hoge(C+1-i,B+1)%mo)%=mo;
		cout<<ret%mo<<endl;
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}
0