#希望这是牛客最简单的解法,求点赞 import sys import itertools data=sys.stdin.readlines() m=data[0].strip("\n").split(" ") for i in range(len(m)): m[i]=int(m[i]) def love(a,b): result=[] result.append(a+b) result.append(a-b) result.append(a*b) result.append(a/b) return result a=itertools.permutations(m,4) def calc(a): for item in a: r=love(item[0],item[1]) r2=[] for c in r: r2=r2+love(c,item[2]) r3=[] for c in r2: r3=r3+love(c,item[3]) for c in r3: if c==24: return 'true' return 'false' r=calc(a) print(r)