結果

問題 No.442 和と積
ユーザー ogapyogapy
提出日時 2022-07-05 23:32:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 257 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 71,636 KB
最終ジャッジ日時 2023-08-22 14:00:16
合計ジャッジ時間 3,162 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 72 ms
71,288 KB
testcase_02 AC 73 ms
71,276 KB
testcase_03 AC 70 ms
71,508 KB
testcase_04 WA -
testcase_05 AC 71 ms
71,580 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 70 ms
71,436 KB
testcase_10 WA -
testcase_11 AC 70 ms
71,416 KB
testcase_12 AC 70 ms
71,552 KB
testcase_13 AC 70 ms
71,152 KB
testcase_14 AC 69 ms
71,508 KB
testcase_15 AC 70 ms
71,380 KB
testcase_16 AC 69 ms
71,536 KB
testcase_17 AC 70 ms
71,432 KB
testcase_18 WA -
testcase_19 AC 69 ms
71,636 KB
testcase_20 AC 70 ms
71,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def GCD(a, b):
  if b == 0:
    return a
  else:
    return GCD(b, a % b)
def solve(A, B):
  g = GCD(A, B)
  a, b = A//g, B//g
  G = 1
  G *= GCD(a+b, a)
  G *= GCD(a+b, b)
  G *= g
  return G

A, B = map(int, input().split())

ans = solve(A, B)
print(ans)
0