結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
31,140 KB
testcase_01 AC 42 ms
31,004 KB
testcase_02 AC 41 ms
31,288 KB
testcase_03 AC 52 ms
30,992 KB
testcase_04 AC 41 ms
31,024 KB
testcase_05 AC 42 ms
31,180 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 40 ms
31,064 KB
testcase_10 WA -
testcase_11 AC 41 ms
31,136 KB
testcase_12 AC 41 ms
30,884 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 42 ms
31,076 KB
testcase_16 AC 41 ms
31,100 KB
testcase_17 WA -
testcase_18 AC 40 ms
31,348 KB
testcase_19 AC 121 ms
31,312 KB
testcase_20 AC 403 ms
33,420 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 41 ms
31,128 KB
testcase_24 AC 41 ms
31,124 KB
testcase_25 AC 687 ms
35,852 KB
testcase_26 AC 41 ms
31,020 KB
testcase_27 AC 42 ms
31,384 KB
testcase_28 AC 42 ms
30,972 KB
testcase_29 AC 41 ms
31,208 KB
testcase_30 WA -
testcase_31 AC 42 ms
31,016 KB
testcase_32 AC 328 ms
33,296 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 AC 625 ms
35,728 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);
echo PHP_EOL;
0