結果

問題 No.2203 POWER!!!!!
ユーザー ThetaTheta
提出日時 2023-02-06 14:44:42
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 10,760 KB
実行使用メモリ 12,164 KB
最終ジャッジ日時 2023-09-18 02:10:17
合計ジャッジ時間 2,388 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,924 KB
testcase_01 AC 16 ms
7,952 KB
testcase_02 AC 16 ms
7,760 KB
testcase_03 AC 15 ms
7,868 KB
testcase_04 AC 15 ms
7,860 KB
testcase_05 AC 16 ms
7,964 KB
testcase_06 AC 15 ms
7,832 KB
testcase_07 AC 16 ms
7,812 KB
testcase_08 AC 40 ms
8,724 KB
testcase_09 AC 84 ms
9,172 KB
testcase_10 AC 133 ms
10,060 KB
testcase_11 AC 190 ms
10,860 KB
testcase_12 AC 40 ms
8,708 KB
testcase_13 AC 87 ms
12,152 KB
testcase_14 AC 88 ms
12,144 KB
testcase_15 AC 87 ms
12,024 KB
testcase_16 AC 86 ms
12,156 KB
testcase_17 AC 87 ms
12,164 KB
testcase_18 AC 15 ms
7,956 KB
testcase_19 AC 16 ms
7,808 KB
testcase_20 AC 16 ms
7,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    A = list(map(int, input().split()))
    partial_results = [-1] * 8
    sum_ = 0
    for base in A:
        if partial_results[base-1] == -1:
            partial = sum(base ** a_elm for a_elm in A)
            partial_results[base-1] = partial
        sum_ += partial_results[base-1]
    print(sum_)


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