結果
| 問題 | No.16 累乗の加算 |
| コンテスト | |
| ユーザー |
arrows
|
| 提出日時 | 2017-01-21 19:10:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 433 bytes |
| 記録 | |
| コンパイル時間 | 785 ms |
| コンパイル使用メモリ | 64,128 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 04:22:22 |
| 合計ジャッジ時間 | 1,499 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 10 |
ソースコード
#include <iostream>
using namespace std;
using ll = long long;
ll mod_pow(ll x, ll n, ll mod)
{
if (n == 0) return 1;
ll res = mod_pow(x * x % mod, n / 2, mod);
if (n & 1) res = res * x % mod;
return res;
}
int main()
{
ll x, N, res = 0;
cin >> x >> N;
for (int i = 0; i < N; i++) {
ll a;
cin >> a;
res += mod_pow(x, a, 1000003);
}
cout << res << endl;
return 0;
}
arrows