結果

問題 No.16 累乗の加算
ユーザー dnishdnish
提出日時 2017-01-30 18:50:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 335 bytes
コンパイル時間 1,522 ms
コンパイル使用メモリ 164,764 KB
実行使用メモリ 784,860 KB
最終ジャッジ日時 2023-08-25 15:18:44
合計ジャッジ時間 15,244 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
	int x,N;
	cin>>x>>N;
	int a[N];
	long long int dp[100000004],sum=0;
	dp[0]=1;
	for(int i=1;i<=100000000;i++){
		dp[i]=(dp[i-1]*x)%1000003;
	}
	
	for(int i=0;i<N;i++){
		cin>>a[i];
	}
	
	for(int i=0;i<N;i++){
		sum+=dp[a[i]];
		sum%=1000003;
	}
	cout<<sum<<endl;
	return 0;	
}
0