結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-23 23:37:52 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 5,000 ms |
| コード長 | 409 bytes |
| コンパイル時間 | 3,068 ms |
| コンパイル使用メモリ | 278,288 KB |
| 実行使用メモリ | 11,484 KB |
| 最終ジャッジ日時 | 2025-08-23 23:37:57 |
| 合計ジャッジ時間 | 4,121 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000003;
long long xp[mod - 1];
int main(void) {
int x, N;
cin >> x >> N;
xp[0] = 1;
for(int i = 1; i < mod - 1; ++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 - 1)]) % mod;
cout << ans << endl;
return 0;
}