結果
問題 |
No.2203 POWER!!!!!
|
ユーザー |
![]() |
提出日時 | 2025-03-20 21:04:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 79 ms / 2,000 ms |
コード長 | 437 bytes |
コンパイル時間 | 173 ms |
コンパイル使用メモリ | 82,252 KB |
実行使用メモリ | 98,256 KB |
最終ジャッジ日時 | 2025-03-20 21:04:18 |
合計ジャッジ時間 | 2,244 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
n = int(input()) A = list(map(int, input().split())) # Count the occurrences of each number (1 to 8) count = [0] * 9 for num in A: count[num] += 1 # Precompute sum_pows for each a from 1 to 8 sum_pows = [0] * 9 for a in range(1, 9): total = 0 for k in range(1, 9): total += (a ** k) * count[k] sum_pows[a] = total # Calculate the total answer answer = 0 for num in A: answer += sum_pows[num] print(answer)