結果

問題 No.118 門松列(2)
ユーザー kyuna
提出日時 2019-07-28 03:39:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 544 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 73,448 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 14:56:00
合計ジャッジ時間 1,777 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int MOD = (int)1e9 + 7;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int &ai: a) cin >> ai;
    vector<int> cnt(101);
    for (int ai: a) cnt[ai]++;
    long long ans = 0;
    for (int i = 1; i <= 100; i++) {
        for (int j = i + 1; j <= 100; j++) {
            for (int k = j + 1; k <= 100; k++) {
                (ans += 1LL * cnt[i] * cnt[j] * cnt[k]) %= MOD;
            }
        }
    }
    cout << ans << endl;
    return 0;
}
0