我大概是这样的思路
m=float(input(请输入m的值:”))
n=float(input(请输入n的值:”))
def
if m大于n
a=m!
b=(m-n)!
c=m!/(m-n)!
return c
else
print(“输入的值无法进行计算”)
应该有很多不恰当的地方
应该有很多不恰当的地方
如果没有调库的限制:
import math
def calculate_combination(m, n):
if m > n:
return "Error: m should be less than or equal to n"
if m < 0 or n < 0:
return "Error: m and n should be non-negative integers"
return math.comb(n, m)
# 输入m和n
m = int(input("Enter m: "))
n = int(input("Enter n: "))
# 调用函数并输出结果
result = calculate_combination(m, n)
print(result)