結果

問題 No.2203 POWER!!!!!
ユーザー おきょん.おきょん.
提出日時 2023-02-04 20:25:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 82,544 KB
実行使用メモリ 96,960 KB
最終ジャッジ日時 2024-07-03 16:54:23
合計ジャッジ時間 2,035 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

# Function to calculate power
def pow(a: int, b: int):
    ret = 1
    for i in range(b):
        ret *= a
    return ret

# Main Function
def main():
    # Read number of elements
    n = int(input())
    # Read array elements
    a = list(map(int, input().split()))

    # Array to count frequencyc of each numbers
    counter = [0 for i in range(9)]
    for v in a:
        counter[v] += 1
    
    # Variable to store answer
    ans = 0

    for b in range(1, 9):
        for e in range(1, 9):
            ans += counter[b] * counter[e] * pow(b, e)

    # Print ans
    print(ans)

if __name__ == "__main__":
    main()
0