結果

問題 No.16 累乗の加算
ユーザー 綾地寧々綾地寧々
提出日時 2015-06-21 07:52:23
言語 PHP
(8.3.4)
結果
TLE  
実行時間 -
コード長 489 bytes
コンパイル時間 1,253 ms
コンパイル使用メモリ 18,504 KB
実行使用メモリ 253,356 KB
最終ジャッジ日時 2023-09-21 22:17:10
合計ジャッジ時間 7,807 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
19,000 KB
testcase_01 AC 14 ms
19,228 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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$start = microtime(TRUE);
list($x, $n) = explode(" ",trim(fgets(STDIN)));
$exp_array = explode(" ",trim(fgets(STDIN)));
$gmp_x = gmp_init(intval($x));
$gmp_sum = gmp_init(0);
foreach ( $exp_array as $exp ) {
	$gmp_sum = gmp_add($gmp_sum, gmp_pow($gmp_x, intval($exp)));
}
echo gmp_strval(gmp_div_r($gmp_sum, gmp_init(1000003))).PHP_EOL;
$exec = microtime(TRUE) - $start;
fprintf(STDERR, "EXEC: {$exec} seconds\n");
fprintf(STDERR, "MEM: %d KiB\n", memory_get_peak_usage(TRUE)/1024);
0