結果

問題 No.36 素数が嫌い!
ユーザー yuki2006yuki2006
提出日時 2015-07-23 12:43:26
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 427 bytes
コンパイル時間 1,348 ms
コンパイル使用メモリ 18,532 KB
実行使用メモリ 19,188 KB
最終ジャッジ日時 2023-09-22 21:36:58
合計ジャッジ時間 14,644 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 674 ms
19,096 KB
testcase_01 AC 67 ms
19,096 KB
testcase_02 AC 15 ms
19,104 KB
testcase_03 AC 15 ms
18,920 KB
testcase_04 AC 15 ms
18,988 KB
testcase_05 AC 22 ms
19,152 KB
testcase_06 AC 24 ms
18,984 KB
testcase_07 AC 25 ms
19,172 KB
testcase_08 AC 15 ms
19,120 KB
testcase_09 AC 15 ms
18,916 KB
testcase_10 AC 16 ms
19,008 KB
testcase_11 AC 942 ms
18,912 KB
testcase_12 AC 2,873 ms
19,056 KB
testcase_13 AC 2,849 ms
19,000 KB
testcase_14 AC 25 ms
19,140 KB
testcase_15 WA -
testcase_16 AC 15 ms
19,088 KB
testcase_17 AC 15 ms
18,984 KB
testcase_18 AC 15 ms
19,176 KB
testcase_19 AC 130 ms
19,028 KB
testcase_20 AC 106 ms
19,188 KB
testcase_21 AC 388 ms
18,964 KB
testcase_22 AC 59 ms
19,088 KB
testcase_23 AC 33 ms
19,096 KB
testcase_24 AC 424 ms
19,128 KB
testcase_25 AC 505 ms
19,056 KB
testcase_26 AC 1,010 ms
19,052 KB
testcase_27 AC 66 ms
19,124 KB
testcase_28 AC 990 ms
19,012 KB
testcase_29 AC 36 ms
19,128 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$n = intval(fgets(STDIN));
$gmp_n = gmp_init($n);
$fact_time = 0;
$i = 2;
$gmp_one=gmp_init(1);
for ( ; gmp_cmp($i*$i,$gmp_n)<0; $i++ ) {
	while ( gmp_cmp(gmp_div_r($gmp_n,$i),0) == 0 ) {
		$gmp_n = gmp_div_q($gmp_n, $i);
		$fact_time++;
	}
	if ( $fact_time > 2 ) {
		break;
	}
}
if (gmp_cmp(gmp_div_r($gmp_n,$i),1) > 0){
	$fact_time++;
}
if ( $fact_time > 2 ) {
    echo "YES".PHP_EOL;
}
else {
    echo "NO".PHP_EOL;
}
0