結果
| 問題 | No.16 累乗の加算 |
| コンテスト | |
| ユーザー |
fumi6328
|
| 提出日時 | 2018-09-14 15:45:15 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 520 bytes |
| 記録 | |
| コンパイル時間 | 456 ms |
| コンパイル使用メモリ | 67,712 KB |
| 実行使用メモリ | 8,576 KB |
| 最終ジャッジ日時 | 2024-07-05 17:28:09 |
| 合計ジャッジ時間 | 7,009 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 11 |
ソースコード
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
long long x,n,a,ans = 0,tx;
cin >> x >> n;
for(int i = 0; i < n; i++){
cin >> a;
if(a == 0) ans++;
else{
tx = x;
for(int i = 1; i < a; i++){
tx *= x;
if(tx > 1000003) tx %= 1000003;
}
ans += tx;
if(ans > 1000003) ans %= 1000003;
}
}
cout << ans << endl;
return 0;
}
fumi6328