matchWall.py 327 B

1234567891011
  1. # 判断能否摆下组件的贴墙边
  2. def canMathc(wallLength,moduleLengths):
  3. moduleTotalLength = 0;
  4. for item in moduleLengths:
  5. moduleTotalLength = moduleTotalLength + item
  6. if(moduleTotalLength <= wallLength):
  7. return 1
  8. else:
  9. return 0
  10. matchResult = canMathc(3,(1,1,2))
  11. print(matchResult)