結果

問題 No.16 累乗の加算
ユーザー Unbakedbread
提出日時 2025-08-23 23:34:24
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 389 bytes
コンパイル時間 2,656 ms
コンパイル使用メモリ 276,392 KB
実行使用メモリ 11,164 KB
最終ジャッジ日時 2025-08-23 23:34:31
合計ジャッジ時間 6,203 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 RE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

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

const int mod = 1000003;

long long xp[mod];

int main(void) {
	int x, N;
	cin >> x >> N;
	
	xp[0] = 1;
	for(int i = 1; i < mod; ++i) xp[i] = (xp[i - 1] * x) % mod;
	
	vector<int> A(N);
	for(int i = 0; i < N; ++i) cin >> A[i];
	
	long long ans = 0;
	for(int i = 0; i < N; ++ i) ans = (ans + xp[A[i]]) % mod;
	cout << ans << endl;
	return 0;
}
0