結果

問題 No.2203 POWER!!!!!
ユーザー jiangly
提出日時 2023-02-09 21:33:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 541 bytes
コンパイル時間 1,719 ms
コンパイル使用メモリ 191,500 KB
最終ジャッジ日時 2025-02-10 11:48:58
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using i64 = long long;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int n;
    std::cin >> n;
    
    std::array<int, 9> cnt{};
    for (int i = 0; i < n; i++) {
        int x;
        std::cin >> x;
        cnt[x]++;
    }
    
    i64 ans = 0;
    for (int i = 1; i <= 8; i++) {
        int v = 1;
        for (int j = 1; j <= 8; j++) {
            v *= i;
            ans += 1LL * v * cnt[i] * cnt[j];
        }
    }
    std::cout << ans << "\n";
    
    return 0;
}
0