結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;


int main() {
    int n;
    cin>>n;
    vector<long long> a(9);
    for(int i=0; i<n; i++){
        int ai;
        cin>>ai;
        a[ai]++;
    }

    long long ans=0LL;
    for(int i=1; i<=8; i++){
        for(int j=1; j<=8; j++){
            long long t = pow(i,j);
            ans += a[i]*a[j]*t;
        }
    }

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