結果

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

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;cin>>n;
  vector<long long> A(9);
  for(int i = 0; n > i; i++){
    int x;cin>>x;
    A[x]++;
  }
  long long ans = 0;
  for(int i = 1; 8 >= i; i++){
    long long nw = i;
    for(int j = 1; 8 >= j; j++){
      long long count = A[i]*A[j];
      ans += nw*count;
      nw *= i;
    }
  }
  cout << ans << endl;
}
0