結果
問題 |
No.2203 POWER!!!!!
|
ユーザー |
![]() |
提出日時 | 2025-03-20 21:04:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 81 ms / 2,000 ms |
コード長 | 437 bytes |
コンパイル時間 | 215 ms |
コンパイル使用メモリ | 82,264 KB |
実行使用メモリ | 97,516 KB |
最終ジャッジ日時 | 2025-03-20 21:04:20 |
合計ジャッジ時間 | 2,105 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)