結果

問題 No.118 門松列(2)
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-09-16 14:31:45
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 397 ms
コンパイル使用メモリ 53,436 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-28 14:34:42
合計ジャッジ時間 1,520 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
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 <cstdio>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

int n, a[100010];
const int mod = 1e9 + 7;

ll conbination(int x){
	ll ret = x * (x - 1) * (x - 2) / 6;
	return ret;
}

int main(void){
	cin >> n;
	rep(i, n) cin >> a[i];

	int cnt[110];
	rep(i, 110) cnt[i] = 0;
	rep(i, n){
		cnt[a[i]]++;
	}

	int c = 0, k = 1;
	rep(i, 101){
		if(cnt[i] >= 1){
			k *= cnt[i];
			c++;
		}
	}
	// printf("%d %d\n", c, k);
	ll ans = conbination(c) * k % mod;
	// printf("%lld\n", ans);
	return 0;
}
0