math: gcd, lcm, comb
Completed
Read two positive integers a and b. Print gcd, lcm, and C(a+b, b) (the number of ways to choose b items from a+b).
Input
One line: a b.
Output
Three lines.
Example
Input
12 18
Output
6 36 86493225
Editor
Python
Hints
math.gcd, math.lcm and math.comb are all built in.
Solution explanation
Check the standard library before writing an algorithm yourself.
Show solution
import math
a, b = map(int, input().split())
print(math.gcd(a, b))
print(math.lcm(a, b))
print(math.comb(a + b, b))