結果

問題 No.2 素因数ゲーム
ユーザー kazukazu
提出日時 2019-03-18 16:26:13
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 11,536 KB
実行使用メモリ 400,368 KB
最終ジャッジ日時 2023-09-25 13:56:39
合計ジャッジ時間 10,122 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,268 KB
testcase_01 WA -
testcase_02 AC 86 ms
15,068 KB
testcase_03 AC 82 ms
15,220 KB
testcase_04 AC 82 ms
15,072 KB
testcase_05 WA -
testcase_06 AC 80 ms
15,140 KB
testcase_07 WA -
testcase_08 AC 399 ms
35,332 KB
testcase_09 AC 82 ms
15,252 KB
testcase_10 AC 83 ms
15,604 KB
testcase_11 WA -
testcase_12 AC 79 ms
14,948 KB
testcase_13 WA -
testcase_14 AC 84 ms
15,516 KB
testcase_15 AC 83 ms
15,144 KB
testcase_16 WA -
testcase_17 AC 119 ms
17,672 KB
testcase_18 AC 81 ms
15,072 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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