結果
| 問題 | No.2203 POWER!!!!! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-03 22:19:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 2,000 ms |
| コード長 | 719 bytes |
| コンパイル時間 | 879 ms |
| コンパイル使用メモリ | 98,612 KB |
| 最終ジャッジ日時 | 2025-02-10 09:28:14 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)
ll pow(ll a, ll b){
ll res = 1LL;
for (int i = 0; i < b;i++){
res *= a;
}
return res;
}
void solve(){
int n;
cin >> n;
vector<int> a(n);
rep(i,n) cin >> a[i];
map<ll,ll> mp;
ll ans = 0;
for (int i = 0; i < n;i++){
mp[a[i]]++;
}
for (int i = 0; i < n;i++){
for (auto [x,y]:mp){
ans += pow(a[i],x)*y;
}
}
cout << ans << endl;
return;
}
int main(){
int tt = 1;
//cin >> tt;
while(tt--){
solve();
}
return 0;
}