主题:小学题 如何编程
各位:在小学四年级暑假作业中,有一道数学题:
用不同的数代替下列文字,使算式成立:四季春夏秋冬×春=春夏秋冬四季.
请问:如何编程得到这六个文字对应的数字.
拜托了[color=00FF00][/color][color=00FFFF][/color]
我编了以下程序:
var a,b,c,d,e,f:integer;
begin
for a:=0 to 9 do
for b:=0 to 9 do
for c:=0 to 9 do
for d:=0 to 9 do
for e:=0 to 9 do
for f:=0 to 9 do
if (a<>b) and (a<>c) and (a<>d) and (a<>e) and (a<>f) and (b<>c) and (b<>d)and (b<>e) and (b<>f) and (c<>d) and (c<>e) and (c<>f) and (d<>e) and (d<>f) and (e<>f) then
if ((a*100000+b*10000+c*1000+d*100+e*10+f)*c=c*100000+d*10000+e*1000+f*100+a*10+b)
then
write(a,b,c,d,e,f);
end.
但测试无结果.不知哪儿出错了.
用不同的数代替下列文字,使算式成立:四季春夏秋冬×春=春夏秋冬四季.
请问:如何编程得到这六个文字对应的数字.
拜托了[color=00FF00][/color][color=00FFFF][/color]
我编了以下程序:
var a,b,c,d,e,f:integer;
begin
for a:=0 to 9 do
for b:=0 to 9 do
for c:=0 to 9 do
for d:=0 to 9 do
for e:=0 to 9 do
for f:=0 to 9 do
if (a<>b) and (a<>c) and (a<>d) and (a<>e) and (a<>f) and (b<>c) and (b<>d)and (b<>e) and (b<>f) and (c<>d) and (c<>e) and (c<>f) and (d<>e) and (d<>f) and (e<>f) then
if ((a*100000+b*10000+c*1000+d*100+e*10+f)*c=c*100000+d*10000+e*1000+f*100+a*10+b)
then
write(a,b,c,d,e,f);
end.
但测试无结果.不知哪儿出错了.