結果

問題 No.16 累乗の加算
ユーザー SeiyaT
提出日時 2021-09-10 17:06:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 315 bytes
コンパイル時間 3,169 ms
コンパイル使用メモリ 229,976 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-11 15:49:48
合計ジャッジ時間 3,841 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;

using ll=long long;
ll mod=1000003;
ll INF=1LL<<60;

int main() {
  int N;
  ll X,ans=0;
  cin >> X >> N;
  for(int i=0;i<N;i++){
	  int A;
	  cin >> A;
	  ans+=pow_mod(X,A,mod);
	  ans%=mod;
  }
  cout << ans << endl;
}
0