結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー papinianuspapinianus
提出日時 2016-08-31 22:29:39
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 401 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 30,868 KB
実行使用メモリ 52,360 KB
最終ジャッジ日時 2024-04-26 22:00:43
合計ジャッジ時間 7,868 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 40 ms
31,040 KB
testcase_03 WA -
testcase_04 AC 40 ms
31,068 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 41 ms
30,976 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 41 ms
30,904 KB
testcase_12 AC 40 ms
31,176 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 40 ms
31,224 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 40 ms
30,932 KB
testcase_22 AC 40 ms
31,016 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 40 ms
31,240 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 40 ms
31,236 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 TLE -
testcase_34 TLE -
testcase_35 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
list($num, $len) = explode(" ", trim(fgets(STDIN)));
$num--;
$sum = gmp_init("0");
$max = (int)floor($len/$num);
if($max >= 2) {
	$prime = 2;
	$primes = [2];
	while(($prime = gmp_nextprime($prime)) <= $max) {
	    $primes[] = (int)gmp_strval($prime);
	}
	foreach($primes as $prime) {
	    $sum = gmp_add($sum, $len+1 - ($prime*$num));
	}
	print_r($primes);
}
echo gmp_strval($sum);
echo PHP_EOL;
0