結果
問題 |
No.2203 POWER!!!!!
|
ユーザー |
![]() |
提出日時 | 2024-05-14 00:29:49 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 698 bytes |
コンパイル時間 | 4,349 ms |
コンパイル使用メモリ | 247,348 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-20 09:42:14 |
合計ジャッジ時間 | 4,306 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; inline ll poww(ll x, ll n) { ll res = 1; while (n > 0) { if (n & 1) res *= x; x *= x; n >>= 1; } return res; } int main() { int n; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; vector<int> cnt(9, 0); rep(i, n) cnt[a[i]]++; ll ans = 0; for (int i = 1; i <= 8; i++) { for (int j = 1; j <= 8; j++) { ans += (ll) cnt[i] * cnt[j] * poww(i, j); } } cout << ans << endl; return 0; }