結果
問題 | No.1113 二つの整数 / Two Integers |
ユーザー |
![]() |
提出日時 | 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=cans=[]while c%2==0 && c>0 doans<<2c/=2endif (c.prime?)==false thenq=3while q*q<=c dohit=falsewhile c>0 && c%q==0 dohit=trueans<<qc/=qendif hit && c.prime? thenans<<cc=1breakendq+=2endendans<<c if c.prime?hs={}ans.each{|e|hs[e]=0 if hs.member?(e)==falsehs[e]+=1}ans=1hs.values.each{|a|ans*=(a+1)}if ans%2==0 thenputs "Even"elseputs "Odd"end