結果

問題 No.16 累乗の加算
ユーザー tsukio
提出日時 2016-03-07 19:29:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 444 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 54,644 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-09-24 15:11:37
合計ジャッジ時間 6,845 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1 -- * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:30:15: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |         system("pause");
      |         ~~~~~~^~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

const int Mod = 1000003;

long long PowMod(int radix, int index) {
	long long ret = 1;
	for (int i = 1; i <= index; i++) {
		ret = ret * radix % Mod;
	}

	return ret;
}


int main() {
	int x, n;
	cin >> x >> n;

	long long sum = 0;
	for (int i = 0; i < n; i++) {
		int index;
		cin >> index;
		sum += PowMod(x, index);
	}

	cout << sum % Mod << endl;

	system("pause");

	return 0;
}
0