結果
| 問題 | No.16 累乗の加算 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-12-11 22:40:13 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 640 bytes |
| 記録 | |
| コンパイル時間 | 709 ms |
| コンパイル使用メモリ | 99,464 KB |
| 実行使用メモリ | 16,200 KB |
| 最終ジャッジ日時 | 2026-03-05 02:55:09 |
| 合計ジャッジ時間 | 59,347 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 TLE * 8 |
ソースコード
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define rep(i,x) for(int i=0;i<(int)(x);++i)
int main(){
int x, n, ret = 0;
cin >> x >> n;
ll a, tmp;
rep(i,n) {
cin >> a;
if (!a) ++ret;
else {
tmp = 1;
for (ll j=0; j<a; ++j) tmp = (tmp*x)%1000003;
ret += tmp;
}
ret %= 1000003;
}
cout << ret << endl;
return 0;
}