結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
31,036 KB
testcase_01 AC 40 ms
31,228 KB
testcase_02 AC 39 ms
31,076 KB
testcase_03 AC 51 ms
31,104 KB
testcase_04 AC 39 ms
31,240 KB
testcase_05 AC 40 ms
31,072 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 40 ms
30,960 KB
testcase_10 WA -
testcase_11 AC 40 ms
30,908 KB
testcase_12 AC 39 ms
31,140 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 39 ms
30,992 KB
testcase_16 AC 39 ms
31,020 KB
testcase_17 WA -
testcase_18 AC 40 ms
31,096 KB
testcase_19 AC 120 ms
31,244 KB
testcase_20 AC 400 ms
33,552 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 40 ms
31,176 KB
testcase_24 AC 39 ms
31,068 KB
testcase_25 AC 683 ms
35,728 KB
testcase_26 AC 41 ms
31,260 KB
testcase_27 AC 40 ms
31,036 KB
testcase_28 AC 40 ms
31,136 KB
testcase_29 AC 41 ms
30,932 KB
testcase_30 WA -
testcase_31 AC 40 ms
31,220 KB
testcase_32 AC 320 ms
33,164 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 AC 618 ms
35,600 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
list($num, $len) = explode(" ", trim(fgets(STDIN)));
$num--;
$sum = gmp_init("0");
$max = (int)ceil($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);
0