結果

問題 No.16 累乗の加算
ユーザー dnishdnish
提出日時 2017-01-30 19:03:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 362 bytes
コンパイル時間 2,009 ms
コンパイル使用メモリ 163,924 KB
実行使用メモリ 784,504 KB
最終ジャッジ日時 2023-08-25 15:21:23
合計ジャッジ時間 10,190 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 MLE -
testcase_03 AC 275 ms
302,264 KB
testcase_04 AC 337 ms
383,304 KB
testcase_05 AC 392 ms
444,644 KB
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,maxi=0;
	cin>>x>>N;
	int a[N];
	long long int dp[100000004],sum=0;
	dp[0]=1;
	
	for(int i=0;i<N;i++){
		cin>>a[i];
		maxi=max(maxi,a[i]);
	}
	
	for(int i=1;i<=maxi;i++){
		dp[i]=(dp[i-1]*x)%1000003;
	}
	
	for(int i=0;i<N;i++){
		sum+=dp[a[i]];
		sum%=1000003;
	}
	cout<<sum<<endl;
	return 0;	
}
0