結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
prog470
|
| 提出日時 | 2016-09-24 14:05:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 582 bytes |
| コンパイル時間 | 572 ms |
| コンパイル使用メモリ | 68,928 KB |
| 実行使用メモリ | 8,448 KB |
| 最終ジャッジ日時 | 2024-11-17 21:43:29 |
| 合計ジャッジ時間 | 59,991 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 TLE * 9 |
ソースコード
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main() {
long long MOD = 1000003, x, N, a[105], ans = 0;
cin >> x >> N;
for (int i = 0; i < N; i++) {
cin >> a[i];
}
for (int i = 0; i < N; i++) {
long long cnt = 1;
for (int j = 0; j < a[i]; j++) {
cnt = cnt * x % MOD;
}
//cout << "cnr: " << cnt << endl;
ans = (ans + cnt) % MOD;
}
cout << ans << endl;
return 0;
}
prog470