結果

問題 No.16 累乗の加算
ユーザー amtgjwamtgjw
提出日時 2018-05-02 23:25:39
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 462 bytes
コンパイル時間 1,531 ms
コンパイル使用メモリ 59,872 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-10 08:58:05
合計ジャッジ時間 7,036 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>

using namespace std;

#define INF 		2000000007
#define MOD			1000003

#define REP(i,n)	for(int i=0;i<n;++i)

typedef unsigned long long int ull;

int main(){
	int x,N;
	scanf("%d %d",&x,&N);

	vector<ull> a(N);
	for(int i=0;i<N;++i)
		cin >> a[i];//*/

	int suml=0;

	for(int i=0;i<N;++i){
		int y = 1;
		for(int j=0;j<a[i];++j){
			y = (y*x)%MOD;
		}
		suml += y;
	}

	cout << suml << endl;

	return 0;
}
0