結果

問題 No.2203 POWER!!!!!
ユーザー おきょん.おきょん.
提出日時 2023-02-04 20:25:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 104,172 KB
最終ジャッジ日時 2023-09-16 16:57:43
合計ジャッジ時間 3,033 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
70,964 KB
testcase_01 AC 71 ms
71,304 KB
testcase_02 AC 73 ms
71,288 KB
testcase_03 AC 73 ms
71,120 KB
testcase_04 AC 73 ms
71,448 KB
testcase_05 AC 72 ms
71,284 KB
testcase_06 AC 72 ms
71,280 KB
testcase_07 AC 71 ms
71,148 KB
testcase_08 AC 78 ms
77,072 KB
testcase_09 AC 85 ms
83,800 KB
testcase_10 AC 89 ms
90,196 KB
testcase_11 AC 100 ms
100,380 KB
testcase_12 AC 76 ms
77,052 KB
testcase_13 AC 104 ms
104,032 KB
testcase_14 AC 105 ms
103,740 KB
testcase_15 AC 103 ms
103,792 KB
testcase_16 AC 104 ms
104,172 KB
testcase_17 AC 107 ms
104,108 KB
testcase_18 AC 72 ms
71,292 KB
testcase_19 AC 71 ms
70,964 KB
testcase_20 AC 69 ms
71,192 KB
権限があれば一括ダウンロードができます

ソースコード

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