結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-06 16:03:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 416 bytes |
| コンパイル時間 | 485 ms |
| コンパイル使用メモリ | 63,616 KB |
| 実行使用メモリ | 394,240 KB |
| 最終ジャッジ日時 | 2024-11-23 23:51:32 |
| 合計ジャッジ時間 | 9,557 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 12 |
ソースコード
#include <iostream>
using namespace std;
#define N 100000000
#define Q 1000003
int main(void){
int x,n;
int dp[N+1], ans;
cin >> x >> n;
dp[1] = x;
for (int i=2; i<=N; i++){
long long tmp = dp[i/2]*dp[i/2] % Q;
if (i%2) tmp = tmp*x % Q;
dp[i] = tmp;
}
ans = 0;
for (int i=0; i<n; i++){
int a;
cin >> a;
ans += dp[a];
ans %= Q;
}
cout << ans << endl;
return 0;
}