本帖最后由 lin6051 于 2023-12-21 15:18 编辑 $A1=1399.2
$A2=9815.6
$A3=2787.8
$A4=5310.6
$need=2448457
$fw1=-200
$fw2=100
$s=''
For $n1=0 to Int(($need+$fw2)/$A1)+1
For $n2=0 to Int(($need+$fw2)/$A2)+1
For $n3=0 to Int(($need+$fw2)/$A3)+1
For $n4=0 to Int(($need+$fw2)/$A4)+1
$r=$A1*$n1+$A2*$n2+$A3*$n3+$A4*$n4
$r1=Round($r-$need,3)
if $r1>$fw2 then exitloop
if $r1>=$fw1 and $r1<=$fw2 then
;$str='少'
;if $r1>0 then $str='多'
$str='差'
$s&=$A1&'x'&$n1&'+'&$A2&'x'&$n2&'+'&$A3&'x'&$n3&'+'&$A4&'x'&$n4&'='&$r&$str&String($r1)&@CRLF
endif
Next
Next
Next
Next
msgbox(0,'完成','按确定复制结果到剪切板')
CLipPut($s)
简单能用,不知道有没遗漏, 用上面链接的方式直接卡死了
|