結果

問題 No.2203 POWER!!!!!
ユーザー Manuel1024
提出日時 2023-08-17 18:38:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 71,680 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-26 17:47:35
合計ジャッジ時間 2,078 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    for(auto &it: a) cin >> it;

    vector<int> cnt(10, 0);
    for(const auto &it: a) cnt[it]++;

    ll ans = 0;
    for(const auto &it: a){
        ll x = 1;
        for(int i = 1; i <= 8; i++){
            x *= it;
            ans += x*cnt[i];
        }
    }
    cout << ans << endl;
    return 0;
}
0