結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 93 ms
15,280 KB
testcase_02 AC 93 ms
15,144 KB
testcase_03 AC 93 ms
15,324 KB
testcase_04 AC 95 ms
15,108 KB
testcase_05 AC 97 ms
15,156 KB
testcase_06 AC 95 ms
15,300 KB
testcase_07 AC 95 ms
15,236 KB
testcase_08 WA -
testcase_09 AC 95 ms
15,364 KB
testcase_10 AC 93 ms
15,192 KB
testcase_11 AC 93 ms
15,412 KB
testcase_12 AC 94 ms
15,376 KB
testcase_13 AC 94 ms
15,108 KB
testcase_14 AC 94 ms
15,304 KB
testcase_15 AC 93 ms
15,312 KB
testcase_16 AC 93 ms
15,112 KB
testcase_17 AC 93 ms
15,092 KB
testcase_18 AC 95 ms
15,312 KB
testcase_19 AC 99 ms
15,356 KB
testcase_20 AC 96 ms
15,216 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'prime'

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

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

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