結果

問題 No.36 素数が嫌い!
ユーザー 👑 horiesinitihoriesiniti
提出日時 2017-06-27 09:14:35
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,968 ms / 5,000 ms
コード長 216 bytes
コンパイル時間 386 ms
コンパイル使用メモリ 11,272 KB
実行使用メモリ 30,476 KB
最終ジャッジ日時 2023-09-09 08:04:00
合計ジャッジ時間 26,414 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 897 ms
25,696 KB
testcase_01 AC 1,432 ms
30,296 KB
testcase_02 AC 95 ms
15,348 KB
testcase_03 AC 94 ms
15,328 KB
testcase_04 AC 95 ms
15,068 KB
testcase_05 AC 102 ms
15,408 KB
testcase_06 AC 102 ms
15,540 KB
testcase_07 AC 104 ms
15,384 KB
testcase_08 AC 97 ms
15,368 KB
testcase_09 AC 101 ms
15,560 KB
testcase_10 AC 99 ms
15,484 KB
testcase_11 AC 725 ms
24,100 KB
testcase_12 AC 1,968 ms
30,264 KB
testcase_13 AC 1,965 ms
30,300 KB
testcase_14 AC 1,249 ms
28,876 KB
testcase_15 AC 94 ms
15,256 KB
testcase_16 AC 93 ms
15,156 KB
testcase_17 AC 92 ms
15,168 KB
testcase_18 AC 95 ms
15,132 KB
testcase_19 AC 882 ms
25,896 KB
testcase_20 AC 1,946 ms
30,408 KB
testcase_21 AC 1,428 ms
30,380 KB
testcase_22 AC 1,598 ms
30,476 KB
testcase_23 AC 893 ms
25,764 KB
testcase_24 AC 1,054 ms
27,248 KB
testcase_25 AC 1,064 ms
27,412 KB
testcase_26 AC 1,238 ms
28,984 KB
testcase_27 AC 1,600 ms
30,460 KB
testcase_28 AC 1,239 ms
28,768 KB
testcase_29 AC 1,770 ms
30,444 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'
n=gets.to_i

n2=n
ps=[]
Prime.each(10**7) do |p1|
	if p1*p1<=n then
		while n2%p1==0
			ps<<p1
			n2=n2/p1
		end
	else
		break
	end
end
ps<<n2 if n2>1
if ps.size>2 then
	puts "YES"
else
	puts "NO"
end
0