結果

問題 No.1113 二つの整数 / Two Integers
ユーザー 小野寺健小野寺健
提出日時 2021-11-03 13:21:53
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 332 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-04-21 04:16:09
合計ジャッジ時間 3,232 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
17,792 KB
testcase_01 AC 81 ms
12,288 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

A, B = gets.split(" ").map{|s| s.to_i}

def gcd(x, y)
	if y == 0 then
		x
	else
		gcd(y, x%y)
	end
end

def nod(n)
	res = 1
	a = 2
	while a*a <= n do
		next if n % a != 0
		ex = 0
		while n % a == 0 do
			ex += 1
			n /= a
		end
		res *= ex + 1
	end
	res *= 2 if n != 1
	res
end

g = gcd(A, B)

puts nod(g) % 2 == 0 ? "Even" : "Odd"
0