結果
問題 | No.1113 二つの整数 / Two Integers |
ユーザー | 👑 horiesiniti |
提出日時 | 2023-04-08 10:20:22 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 380 bytes |
コンパイル時間 | 131 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-04-14 09:01:47 |
合計ジャッジ時間 | 2,923 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 94 ms
12,160 KB |
testcase_01 | AC | 92 ms
12,288 KB |
testcase_02 | AC | 96 ms
12,160 KB |
testcase_03 | AC | 119 ms
12,160 KB |
testcase_04 | WA | - |
testcase_05 | AC | 115 ms
12,160 KB |
testcase_06 | AC | 90 ms
12,160 KB |
testcase_07 | AC | 92 ms
12,288 KB |
testcase_08 | AC | 90 ms
12,288 KB |
testcase_09 | WA | - |
testcase_10 | AC | 91 ms
12,416 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 94 ms
12,160 KB |
testcase_15 | AC | 121 ms
12,160 KB |
testcase_16 | AC | 89 ms
12,288 KB |
コンパイルメッセージ
Syntax OK
ソースコード
def f(a) d=2 d2=d**2 d3=d**3 ans=1 while true if a%d2==0 then c=3 a/=d2 while a%d==0 a/=d c+=1 end ans*=c end break if a<d3 d+=1 d2=d**2 d3=d**3 end if a>1 || ans%2==0 then puts "Even" else puts "Odd" end end def f2(a,b) n=[a,b].max ans=0 (1..n).each{|d| ans+=1 if a%d==0 && b%d==0 } puts ans end a,b=gets.split(" ").map{|e| e.to_i} n=a.gcd(b) f(n)