結果
問題 | No.2203 POWER!!!!! |
ユーザー |
![]() |
提出日時 | 2023-02-03 21:29:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 624 bytes |
コンパイル時間 | 2,094 ms |
コンパイル使用メモリ | 194,200 KB |
最終ジャッジ日時 | 2025-02-10 08:44:26 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; long long intpow(long long a,long long b) { long long ans = 1; while(b) { if(b & 1) { (ans *= a); } (a *= a); b /= 2; } return ans; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<int>A(N),B(9); for(int i = 0; i < N; i++) { cin >> A[i]; B[A[i]]++; } long long ans = 0; for(int i = 1; i <= 8; i++) { for(int j = 1; j <= 8; j++) { ans += 1ll*B[i]*B[j]*intpow(i,j); } } cout << ans << endl; }