結果

問題 No.2 素因数ゲーム
ユーザー kazu
提出日時 2019-03-18 16:26:13
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 41 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 470,556 KB
最終ジャッジ日時 2024-07-18 10:57:45
合計ジャッジ時間 8,988 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 6 TLE * 2 -- * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def func(num)
	args = []
	ncount = 0
	i = 2
	while num > 1
		args.push(0)
		while num % i == 0
			num = num / i
			args[args.size-1] += 1
		end
		if args.last > 1
			ncount += 1
		end
		i += 1
	end

	if ncount == 0
		if args.size % 2 == 1
			print "Alice"
		else
			print "Bob"
		end
	else
		if ncount % 2 == 1
			print "Alice"
		else
			print "Bob"
		end
	end
	print "\n"
end

func(gets.to_i)
0