目录
题目描述
小组中每位都有一张卡片,卡片上是 6 位内的正整数,将卡片连起来可以组成多种数字,计算组成的最大数字。
输入
输入描述:
“,”号分割的多个正整数字符串,不需要考虑非数字异常情况,小组最多 25 个人
输出
输出描述:
最大的数字字符串
示例
输入:
22,221
1
输出:
22221
1
参考代码
def calc():
global nums_input, dp, dfs
nums_input = input().split(",")
dp = []
def dfs(s):
if len(s) == len(nums_input):
dp.append("".join(s))
else:
for c in nums_input:
if c not in s: