結果

問題 No.1113 二つの整数 / Two Integers
ユーザー 👑 horiesinitihoriesiniti
提出日時 2023-06-22 05:44:01
言語 Ruby
(3.3.0)
結果
AC  
実行時間 196 ms / 1,000 ms
コード長 354 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 11,424 KB
実行使用メモリ 15,348 KB
最終ジャッジ日時 2023-09-12 00:29:04
合計ジャッジ時間 2,872 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,148 KB
testcase_01 AC 79 ms
15,260 KB
testcase_02 AC 86 ms
15,160 KB
testcase_03 AC 113 ms
15,320 KB
testcase_04 AC 84 ms
15,140 KB
testcase_05 AC 103 ms
15,260 KB
testcase_06 AC 79 ms
15,040 KB
testcase_07 AC 79 ms
15,156 KB
testcase_08 AC 79 ms
15,160 KB
testcase_09 AC 196 ms
15,232 KB
testcase_10 AC 80 ms
15,120 KB
testcase_11 AC 78 ms
15,040 KB
testcase_12 AC 85 ms
15,308 KB
testcase_13 AC 78 ms
15,348 KB
testcase_14 AC 83 ms
15,332 KB
testcase_15 AC 107 ms
15,144 KB
testcase_16 AC 79 ms
15,192 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def f(n,l,r)
	m=(l+r)/2
	m2=m*m
	
	if l==r then
		return n==m2
	else
		return true if n==m2
		if n<m2 then
			return f(n,l,m)
		else
			return f(n,m+1,r)
		end
	end
end
a,b=gets.split(" ").map{|e| e.to_i}
c=a.gcd(b)

i=2
while c>=i**3 do
	t=i**2
	while c%t==0 do
		c/=t
	end
	i+=1
end
c=1 if c>1 && f(c,2,c)
if c==1 then
	puts "Odd"
else
	puts "Even"
end
0