結果

問題 No.118 門松列(2)
ユーザー hotpepsihotpepsi
提出日時 2015-01-09 00:31:28
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 775 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 64,152 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-03 22:47:47
合計ジャッジ時間 1,890 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>

using namespace std;

typedef long long LL;

#define COMBSZ 120
#define MOD 1000000007LL

int main(int argc, char *argv[])
{
	LL C[COMBSZ][COMBSZ] = { 1 };		// should be static for larger size
	for (LL i = 1; i < COMBSZ; ++i) {
		C[i][0] = 1;
		for (LL j = 1; j <= i; ++j) {
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
		}
	}

	string s;
	getline(cin, s);
	int N = atoi(s.c_str());
	getline(cin, s);
	stringstream ss(s);
	int cnt[102] = {};
	int t = 0;
	for (LL i = 0; i < N; ++i) {
		int n;
		ss >> n;
		cnt[n] += 1;
		t += cnt[n] == 1;
	}

	LL ans = C[t][3];
	for (LL i = 1; i <= 100; ++i) {
		if (cnt[i] > 0) {
			ans = (ans * cnt[i]) % MOD;
		}
	}

	cout << ans << endl;
	return 0;
}
0