結果

問題 No.1113 二つの整数 / Two Integers
ユーザー 👑 horiesinitihoriesiniti
提出日時 2023-03-02 04:56:44
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 485 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 11,944 KB
実行使用メモリ 20,620 KB
最終ジャッジ日時 2023-10-17 03:32:04
合計ジャッジ時間 6,011 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
16,260 KB
testcase_01 AC 98 ms
16,260 KB
testcase_02 AC 99 ms
16,260 KB
testcase_03 AC 327 ms
16,260 KB
testcase_04 AC 330 ms
16,260 KB
testcase_05 AC 99 ms
16,260 KB
testcase_06 AC 98 ms
16,260 KB
testcase_07 AC 98 ms
16,260 KB
testcase_08 AC 98 ms
16,260 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:5: warning: assigned but unused variable - c2
Syntax OK

ソースコード

diff #

require 'prime'

a,b=gets.split(" ").map{|e| e.to_i}
c=a.gcd(b)
c2=c
ans=[]

while c%2==0 && c>0 do
	ans<<2
	c/=2
end
if (c.prime?)==false then
	q=3
	while q*q<=c do
		hit=false
		while c>0 && c%q==0 do
			hit=true
			ans<<q
			c/=q
		end
		if hit && c.prime? then
			ans<<c
			c=1
			break
		end
		q+=2
	end
end
ans<<c if c.prime?
hs={}
ans.each{|e|
	hs[e]=0 if hs.member?(e)==false
	hs[e]+=1
}
ans=1
hs.values.each{|a|
	ans*=(a+1)
}
if ans%2==0 then
	puts "Even"
else
	puts "Odd"
end
0