結果
問題 | No.1113 二つの整数 / Two Integers |
ユーザー |
![]() |
提出日時 | 2023-04-08 10:20:22 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 380 bytes |
コンパイル時間 | 40 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-10-03 06:04:35 |
合計ジャッジ時間 | 2,203 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 WA * 5 |
コンパイルメッセージ
Syntax OK
ソースコード
def f(a)d=2d2=d**2d3=d**3ans=1while trueif a%d2==0 thenc=3a/=d2while a%d==0a/=dc+=1endans*=cendbreak if a<d3d+=1d2=d**2d3=d**3endif a>1 || ans%2==0 thenputs "Even"elseputs "Odd"endenddef f2(a,b)n=[a,b].maxans=0(1..n).each{|d|ans+=1 if a%d==0 && b%d==0}puts ansenda,b=gets.split(" ").map{|e| e.to_i}n=a.gcd(b)f(n)