結果

問題 No.16 累乗の加算
ユーザー prog470prog470
提出日時 2016-09-24 14:08:17
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 588 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 69,092 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2024-04-29 00:10:42
合計ジャッジ時間 7,109 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 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<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>
#include <stdio.h>

using namespace std;

int main() {

	long long MOD = 1000003, x, N, a[105], ans = 0;
	cin >> x >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}

	for (int i = 0; i < N; i++) {
		long long cnt = 1;
		for (long long j = 0; j < a[i]; j++) {
			cnt = cnt * x % MOD;
		}
		//cout << "cnr: " << cnt << endl;
		ans = (ans + cnt) % MOD;
	}

	cout << ans << endl;

	return 0;
}
0