d=46 for a=1 to 10 for b=1 to 100 for c=1 to 100 if a=b/(3+c)/3+d/3 then if b=a/4+c/4+d/4 then if c=a/5+b/5+d/5 then debug.print a & b & c end if end if end if next next next
没考虑小数位. d=46 for a=0.001 to 100 step 0.001 for b=0.001 to 100 step 0.001 for c=0.001 to 100 step 0.001 if a=b/(3+c)/3+d/3 then if b=a/4+c/4+d/4 then if c=a/5+b/5+d/5 then debug.print a & b & c end if end if end if next next next 好象太慢了:)
错了,汗! d=46 for a=1 to 100 for b=1 to 100 for c=1 to 100 if a=b/3+c/3+d/3 then if b=a/4+c/4+d/4 then if c=a/5+b/5+d/5 then debug.print a & b & c end if end if end if next next next
for a=1 to 10
for b=1 to 100
for c=1 to 100
if a=b/(3+c)/3+d/3 then
if b=a/4+c/4+d/4 then
if c=a/5+b/5+d/5 then
debug.print a & b & c
end if
end if
end if
next
next
next
d=46
for a=0.001 to 100 step 0.001
for b=0.001 to 100 step 0.001
for c=0.001 to 100 step 0.001
if a=b/(3+c)/3+d/3 then
if b=a/4+c/4+d/4 then
if c=a/5+b/5+d/5 then
debug.print a & b & c
end if
end if
end if
next
next
next
好象太慢了:)
a、b、c都是整数
d=46
for a=1 to 100
for b=1 to 100
for c=1 to 100
if a=b/3+c/3+d/3 then
if b=a/4+c/4+d/4 then
if c=a/5+b/5+d/5 then
debug.print a & b & c
end if
end if
end if
next
next
next
你的code我试了,在程序中很快可以得出正确答案,可是不能当作业交给老师,我用硬替换的办法得出的答案,好像思路也太笨了,写了一整张纸才得出答案,我觉得这也不是正解。
a=b/3+c/3+d/3 3a=b+c+d
b=a/4+c/4+d/4 -> 4b=a+c+d ->2a+2b+2c+3d=3a+4b+5c ->a+2b+3c=138;这是第一式.
c=a/5+b/5+d/5 5c=a+b+d
d=46由3a=b+c+d与4b=a+c+d得到4a=5b;
由4b=a+c+d与5c=a+b+d得到5b=6c;
于是4a=5b=6c将提一式乘以4,得到4a+8b+12c=552;代入上面结果得:5b+8b+10b=368->23b=552->b=24;
于是得
a=30
b=24
c=20
d=46
于是得 ~~~
a=30
b=24
c=20
d=46
a是总数的1/4 a=b/3+c/3+d/3=>4a=(a+b+c+d)
b是1/5 同上
c是1/6 同上
所以d是23/60 d=46 所以总数为120后面自己算