已知下例條件
b>0,c>0,d>0,e>0,f>0,g>0,h>0
b+c+d+e+f+g+h=71
8013<=15b+40c+60d+160e+200f+260g+310h<=8033
求b,c,d,e,f,g,h的解
無論用什麼方法,sql和delphi語句都可以,只要能夠求出正確的解且寫明過程就ok.

解决方案 »

  1.   

    随便举一些例子吧,结果实在太多太多了。
    b=15 c=40 d=2040 e=4960 f=400 g=260 h=310
    b=1 c=1 d=35 e=29 f=2 g=2 h=1
    b=1 c=1 d=36 e=24 f=7 g=1 h=1
    b=1 c=1 d=36 e=27 f=2 g=3 h=1
    b=1 c=1 d=36 e=27 f=3 g=1 h=2
    b=1 c=1 d=37 e=22 f=7 g=2 h=1
    b=1 c=1 d=37 e=25 f=2 g=4 h=1
    b=1 c=1 d=37 e=25 f=3 g=2 h=2
    b=1 c=1 d=37 e=26 f=2 g=1 h=3
    b=1 c=1 d=38 e=17 f=12 g=1 h=1
    b=1 c=1 d=38 e=20 f=7 g=3 h=1
    b=1 c=1 d=38 e=20 f=8 g=1 h=2
    b=1 c=1 d=38 e=23 f=2 g=5 h=1
    b=1 c=1 d=38 e=23 f=3 g=3 h=2
    b=1 c=1 d=38 e=24 f=2 g=2 h=3
    b=1 c=1 d=39 e=15 f=12 g=2 h=1
    b=1 c=1 d=39 e=18 f=7 g=4 h=1
    b=1 c=1 d=39 e=18 f=8 g=2 h=2
    b=1 c=1 d=39 e=19 f=7 g=1 h=3
    b=1 c=1 d=39 e=21 f=2 g=6 h=1
      

  2.   

    NightCloud() 正中下懷
    請問可不可以指教指教
      

  3.   

    cuteant(我的旧船票还能否登上你的客船) 你好
    我要的是過程啊
    解我是臏知道有,但只是推算法
      

  4.   

    哈哈,稍微修改一下,总比71^7少多了,不过这也要遍历71*71*71*51*41*31*26次,时间可想而知了,好久好久。可能还有优化的算法吧,我不知道了。
    procedure TForm1.Button4Click(Sender: TObject);
    var
      i, b, c, d, e, f, g, h: integer;
    begin
      i := 0;
      for b:=1 to 71 do
        for c:=1 to 71 do
          for d:=1 to 71 do
            for e:=1 to 51 do
              for f:=1 to 41 do
                for g:=1 to 31 do
                  for h:=1 to 26 do
                  begin
                    Application.ProcessMessages;
                    if (b+c+d+e+f+g+h=71) and (15*b+40*c+60*d+160*e+200*f+260*g+310*h<=8033) and (15*b+40*c+60*d+160*e+200*f+260*g+310*h>=8013) then
                    begin
                      Memo1.Lines.Add('b='+IntToStr(b)+#9+'c='+IntToStr(c)+#9+'d='+IntToStr(d)+#9+'e='+IntToStr(e)+#9+'f='+IntToStr(f)+#9+'g='+IntToStr(g)+#9+'h='+IntToStr(h));
                      Inc(i);
                    end;
                  end;
      ShowMessage('共有'+IntToStr(i)+'组结果');
    end;