結果

問題 No.2203 POWER!!!!!
ユーザー eve__fuyuki
提出日時 2024-04-29 12:26:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 2,123 ms
コンパイル使用メモリ 195,040 KB
最終ジャッジ日時 2025-02-21 09:36:49
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    fast_io();
    int n;
    cin >> n;
    vector<long long> cnt(9);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        cnt[a]++;
    }
    long long ans = 0;
    for (int i = 1; i <= 8; i++) {
        for (int j = 1; j <= 8; j++) {
            long long c = cnt[i] * cnt[j];
            long long pij = 1;
            for (int k = 0; k < j; k++) {
                pij *= i;
            }
            ans += c * pij;
        }
    }
    cout << ans << endl;
}
0