結果

問題 No.36 素数が嫌い!
ユーザー suppy193suppy193
提出日時 2017-01-27 15:50:42
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,082 ms / 5,000 ms
コード長 273 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 11,220 KB
実行使用メモリ 15,576 KB
最終ジャッジ日時 2023-09-09 07:46:21
合計ジャッジ時間 8,313 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 324 ms
15,384 KB
testcase_01 AC 110 ms
15,496 KB
testcase_02 AC 93 ms
15,376 KB
testcase_03 AC 92 ms
15,184 KB
testcase_04 AC 93 ms
15,344 KB
testcase_05 AC 94 ms
15,456 KB
testcase_06 AC 97 ms
15,556 KB
testcase_07 AC 98 ms
15,316 KB
testcase_08 AC 96 ms
15,276 KB
testcase_09 AC 93 ms
15,292 KB
testcase_10 AC 92 ms
15,132 KB
testcase_11 AC 414 ms
15,468 KB
testcase_12 AC 1,080 ms
15,288 KB
testcase_13 AC 1,082 ms
15,576 KB
testcase_14 AC 97 ms
15,444 KB
testcase_15 AC 94 ms
15,184 KB
testcase_16 AC 93 ms
15,236 KB
testcase_17 AC 92 ms
15,348 KB
testcase_18 AC 90 ms
15,092 KB
testcase_19 AC 133 ms
15,456 KB
testcase_20 AC 126 ms
15,364 KB
testcase_21 AC 221 ms
15,360 KB
testcase_22 AC 107 ms
15,500 KB
testcase_23 AC 99 ms
15,252 KB
testcase_24 AC 237 ms
15,384 KB
testcase_25 AC 269 ms
15,420 KB
testcase_26 AC 438 ms
15,420 KB
testcase_27 AC 111 ms
15,380 KB
testcase_28 AC 432 ms
15,436 KB
testcase_29 AC 100 ms
15,252 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'

n = gets.strip.to_i
div = n.prime_division
len = div.length
if len > 2
	puts "YES\n"
elsif len == 1 && div[0][1] == 2
	puts "NO\n"
elsif len == 0
	puts "NO\n"
else
	div.each do |primes|
		if primes[1] > 1
			puts "YES\n"
			exit
		end
	end
	puts "NO\n"
end
0