結果
問題 |
No.16 累乗の加算
|
ユーザー |
![]() |
提出日時 | 2017-05-10 21:36:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 447 bytes |
コンパイル時間 | 1,206 ms |
コンパイル使用メモリ | 157,668 KB |
実行使用メモリ | 784,896 KB |
最終ジャッジ日時 | 2024-09-15 07:12:22 |
合計ジャッジ時間 | 19,911 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | MLE * 14 |
ソースコード
#include"bits/stdc++.h" //#include<bits/stdc++.h> using namespace std; #define print(x) cout<<x<<endl; #define rep(i,a,b) for(int i=a;i<b;i++) typedef long long ll; const int mod = 1000003; ll dp[100000000]; int main() { int x, n; ll a[102]; ll ans = 0; cin >> x >> n; rep(i, 0, n)cin >> a[i]; dp[0] = 1; dp[1] = x; rep(i, 2, 100000000) { dp[i] = dp[i-1] * x%mod; } rep(i, 0, n) { ans += dp[a[i]] % mod; } print(ans); return 0; }