結果
| 問題 | No.1113 二つの整数 / Two Integers |
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2023-03-02 04:56:44 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 485 bytes |
| コンパイル時間 | 330 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 19,232 KB |
| 最終ジャッジ日時 | 2024-09-17 02:09:46 |
| 合計ジャッジ時間 | 4,646 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 TLE * 1 -- * 7 |
コンパイルメッセージ
Main.rb:5: warning: assigned but unused variable - c2 Syntax OK
ソースコード
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
horiesiniti