結果

問題 No.1044 正直者大学
ユーザー kotatsugamekotatsugame
提出日時 2020-05-01 22:08:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 66,296 KB
実行使用メモリ 7,748 KB
最終ジャッジ日時 2023-08-26 14:01:12
合計ジャッジ時間 2,358 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
7,456 KB
testcase_01 AC 6 ms
7,452 KB
testcase_02 AC 6 ms
7,440 KB
testcase_03 AC 6 ms
7,516 KB
testcase_04 AC 6 ms
7,616 KB
testcase_05 AC 6 ms
7,536 KB
testcase_06 AC 32 ms
7,504 KB
testcase_07 AC 7 ms
7,500 KB
testcase_08 AC 6 ms
7,440 KB
testcase_09 AC 6 ms
7,464 KB
testcase_10 AC 6 ms
7,444 KB
testcase_11 AC 6 ms
7,532 KB
testcase_12 AC 8 ms
7,440 KB
testcase_13 AC 20 ms
7,440 KB
testcase_14 AC 7 ms
7,500 KB
testcase_15 AC 8 ms
7,444 KB
testcase_16 AC 21 ms
7,500 KB
testcase_17 AC 11 ms
7,448 KB
testcase_18 AC 15 ms
7,504 KB
testcase_19 AC 8 ms
7,444 KB
testcase_20 AC 6 ms
7,428 KB
testcase_21 AC 8 ms
7,552 KB
testcase_22 AC 6 ms
7,432 KB
testcase_23 AC 6 ms
7,748 KB
testcase_24 AC 6 ms
7,504 KB
testcase_25 AC 6 ms
7,424 KB
testcase_26 AC 6 ms
7,504 KB
testcase_27 AC 6 ms
7,456 KB
testcase_28 AC 6 ms
7,496 KB
testcase_29 AC 6 ms
7,504 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
const long mod=1e9+7;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
long fac[2<<17],inv[2<<17];
long N,M,K;
long comb(int a,int b){return fac[a]*inv[b]%mod*inv[a-b]%mod;}
main()
{
	cin>>N>>M>>K;
	fac[0]=1;
	for(int i=1;i<2<<17;i++)fac[i]=fac[i-1]*i%mod;
	inv[(2<<17)-1]=power(fac[(2<<17)-1],mod-2);
	for(int i=(2<<17)-1;i--;)inv[i]=inv[i+1]*(i+1)%mod;
	long ans=0;
	for(int L=1;;L++)
	{
		if(N+M-2*L<K)break;
		if(N<L||M<L)break;
		(ans+=comb(N-1,L-1)*comb(M-1,L-1)%mod*fac[N]%mod*fac[M]%mod*power(L,mod-2)%mod)%=mod;
	}
	cout<<ans<<endl;
}
0