結果

問題 No.16 累乗の加算
ユーザー Kutimoti_T
提出日時 2017-12-19 17:01:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 437 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 55,360 KB
実行使用メモリ 394,072 KB
最終ジャッジ日時 2024-12-17 20:25:59
合計ジャッジ時間 8,684 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

#define MOD(N) (N % 1000003)
#define FOR(i,s,e) for(int i = (s);i <= (e);i++)

int dp[100000000];

int N;
int x;

int max_ = 0;

int a[100];

int main()
{
	cin >> x >> N;
	FOR(i,0,N -1)
	{
		cin >> a[i];
		max_ = max(max_,a[i]);
	}
	dp[0] = 1;
	FOR(i,1,max_)
	{
		dp[i] = MOD(dp[i - 1] * x);
	}
	int res = 0;
	FOR(i,0,N-1)
	{
		res = MOD(res + dp[a[i]]);
	}
	cout << res << endl;
	return 0;
	
}	
0