結果

問題 No.16 累乗の加算
ユーザー kkslucy1kkslucy1
提出日時 2018-03-10 17:38:25
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 412 bytes
コンパイル時間 1,563 ms
コンパイル使用メモリ 159,604 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-22 16:38:50
合計ジャッジ時間 2,109 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int x, n;
	cin >> x >> n;
	vector<long long> a(n);
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}

	vector<long long> nx(1000003);
	nx[0] = 1;
	for (int i = 1;i < 1000003;i++) {
		nx[i] = nx[i - 1] * x % 1000003;
	}
	long long sum = 0;
	for (int i = 0;i < n;i++) {
		sum += nx[a[i] % 1000003];
		sum %= 1000003;
	}
	cout << sum << endl;


	return 0;
}
0