結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-11-24 08:29:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 522 bytes |
| コンパイル時間 | 1,926 ms |
| コンパイル使用メモリ | 170,024 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 19:05:30 |
| 合計ジャッジ時間 | 2,619 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int const mod = 1000003;
long long culc(long long x, long long y)
{
if(y == 0) return 1;
if(y % 2 == 0) return culc(x * x % mod, y / 2);
return culc(x * x % mod, y / 2) * x % mod;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int x, n; cin >> x >> n;
vector<long long> a(n);
for(int i = 0; i < n; i++) cin >> a[i];
long long ans = 0;
for(int i = 0; i < n; i++) {
ans += culc(x, a[i]);
}
cout << ans % mod << endl;
return 0;
}