結果

問題 No.16 累乗の加算
ユーザー tsukiotsukio
提出日時 2016-03-07 19:29:16
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 444 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 55,864 KB
実行使用メモリ 7,692 KB
最終ジャッジ日時 2023-10-24 20:15:05
合計ジャッジ時間 6,880 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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