結果
問題 |
No.16 累乗の加算
|
ユーザー |
|
提出日時 | 2016-11-13 00:09:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 713 bytes |
コンパイル時間 | 726 ms |
コンパイル使用メモリ | 81,572 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 05:17:52 |
合計ジャッジ時間 | 1,370 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
ソースコード
#define _USE_MATH_DEFINES #include<stdio.h> #include<string> #include<iostream> #include<cctype> #include<cstdio> #include<vector> #include<stack> #include<queue> #include <algorithm> #include<math.h> #include<set> #include<map> #include<iomanip> //#include<bits/stdc++.h> using namespace std; long long int powMod(long long int x, long long int k, long long int m) { if (k == 0) return 1; if (k % 2 == 0) return powMod(x*x % m, k/2, m); else return x*powMod(x, k-1, m) % m; } int main() { long long int a,n; cin>>a>>n; long long int r=0; for(int i=0;i<n;i++){ long long int t; cin>>t; r%=1000003; r+=powMod(a,t,1000003); } r%=1000003; cout<<r<<endl; return 0; }