結果

問題 No.16 累乗の加算
ユーザー トミートミー
提出日時 2024-03-29 23:45:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 494 bytes
コンパイル時間 2,431 ms
コンパイル使用メモリ 203,184 KB
実行使用メモリ 10,004 KB
最終ジャッジ日時 2024-03-29 23:45:20
合計ジャッジ時間 9,103 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
int main() {
    int x, n;
    cin >> x >> n;
    vector<lint> a(n);
    for (lint i = 0; i != a.size(); i++) {
        cin >> a[i];
    }

    lint ans = 0;
    lint mod = 1000003;
    for (lint i = 0; i != a.size(); i++) {
        lint tmp = 1;
        for (lint j = 0; j != a[i]; j++) {
            tmp = (tmp * x) % mod;
        }
        ans = (ans + tmp) % mod;
    }
    cout << ans << endl;

    // system("pause");
}
0