結果

問題 No.2379 Burnside's Theorem
ユーザー YTOK
提出日時 2023-07-14 22:37:25
言語 Julia
(2.11.2)
結果
AC  
実行時間 282 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 7,204 KB
実行使用メモリ 241,336 KB
最終ジャッジ日時 2024-10-01 17:26:40
合計ジャッジ時間 8,054 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

toI(s=readline()) = parse(Int,s)
toVI(s=readline()) = toI.(split(s))
rep(f,n) = [f() for _ in 1:n]
pYesNo(b) = ifelse(b,"Yes","No") |> println

function main()
	n = toI()
	solve(n) |> pYesNo
end

function solve(n)
	length(factor(n)) ≤ 2
end

function factor(n)
	xs = Pair{Int,Int}[]
	n == 1 && return xs
	x = n
	for i in 2:isqrt(n)
		x % i == 0 || continue
		cnt = 0
		while x % i == 0
			cnt += 1
			x ÷= i
		end
		push!(xs,i=>cnt)
	end
	if x > 1
		push!(xs,x=>1)
	end
	xs
end

main()
0