結果

問題 No.442 和と積
ユーザー simansiman
提出日時 2020-11-22 18:01:07
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 154 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 11,460 KB
実行使用メモリ 15,508 KB
最終ジャッジ日時 2023-09-30 23:00:25
合計ジャッジ時間 3,084 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 95 ms
15,392 KB
testcase_02 AC 94 ms
15,096 KB
testcase_03 AC 93 ms
15,144 KB
testcase_04 AC 93 ms
15,144 KB
testcase_05 AC 92 ms
15,312 KB
testcase_06 AC 94 ms
15,104 KB
testcase_07 AC 94 ms
15,276 KB
testcase_08 WA -
testcase_09 AC 92 ms
15,224 KB
testcase_10 AC 92 ms
15,224 KB
testcase_11 AC 92 ms
15,244 KB
testcase_12 AC 92 ms
15,092 KB
testcase_13 AC 92 ms
15,092 KB
testcase_14 AC 92 ms
15,296 KB
testcase_15 AC 94 ms
15,420 KB
testcase_16 AC 94 ms
15,416 KB
testcase_17 AC 94 ms
15,184 KB
testcase_18 AC 92 ms
15,324 KB
testcase_19 AC 94 ms
15,216 KB
testcase_20 AC 93 ms
15,236 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'

A, B = gets.split.map(&:to_i)

def gcd(a, b)
  g = a.gcd(b)
  return 1 if b == 1
  g * gcd(a / g + b / g, g)
end

puts gcd(A + B, A * B)
0