結果

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
#define int long long
int po(int x,int y)
{
    if(y==0) return 1;
    if(y==1) return x;
    if(y%2==0) {int u=po(x,y/2);return (u*u);}
    else {int u=po(x,y-1);return (x*u);}
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    int cnt[9]={0};for(int i=0;i<n;++i) {int x;cin>>x;cnt[x]++;}
    int res=0;
    for(int i=1;i<=8;++i)
    {
        for(int j=1;j<=8;++j)
        {
            res+=cnt[i]*cnt[j]*po(i,j);
        }
    }
    cout<<res;
    return 0;
}
0