結果

問題 No.118 門松列(2)
ユーザー hotpepsi
提出日時 2016-02-19 00:09:04
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 600 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 63,356 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 08:01:03
合計ジャッジ時間 1,875 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;

typedef long long LL;

#define MOD 1000000007LL

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

	LL ans = 0;
	for (LL i = 1; i <= 100; ++i) {
		for (LL j = i + 1; j <= 100; ++j) {
			for (LL k = j + 1; k <= 100; ++k) {
				ans = (ans + cnt[i] * cnt[j] * cnt[k]) % MOD;
			}
		}
	}

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