将1-9这9个数字分成三组(每个数字只能使用一次)
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:数学作业 时间:2024/05/16 06:29:17
将1-9这9个数字分成三组(每个数字只能使用一次)
将1-9这9个数字分成三组(每个数字只能使用一次),分别组成三个三位数,且这三个三位数的值构成1:2:3的比例,试求出所有满足条件的三个三位数.
用FP(free pascal)
将1-9这9个数字分成三组(每个数字只能使用一次),分别组成三个三位数,且这三个三位数的值构成1:2:3的比例,试求出所有满足条件的三个三位数.
用FP(free pascal)
program tianshu;
var bo:array[1..9]of integer;
a,b,c,j:integer;
begin
for a:=123 to 329 do
begin
fillchar(bo,sizeof(bo),0);
j:=0;
b:=a*2;
c:=a*3;
if (a mod 100)and(bo[a mod 10]=0) then
begin
inc(j);
bo[a mod 10]:=1;
end;
if ((a div 10)mod 100)and(bo[(a div 10)mod 10]=0) then
begin
inc(j);
bo[(a div 10)mod 10]:=1;
end;
if (a div 1000)and(bo[a div 100]=0) then
begin
inc(j);
bo[a div 100]:=1;
end;
if (b mod 100)and(bo[b mod 10]=0) then
begin
inc(j);
bo[b mod 10]:=1;
end;
if ((b div 10)mod 100)and(bo[(b div 10)mod 10]=0) then
begin
inc(j);
bo[(b div 10)mod 10]:=1;
end;
if (b div 1000)and(bo[b div 100]=0) then
begin
inc(j);
bo[b div 100]:=1;
end;
if (c mod 100)and(bo[c mod 10]=0) then
begin
inc(j);
bo[c mod 10]:=1;
end;
if ((c div 10)mod 100)and(bo[(c div 10)mod 10]=0) then
begin
inc(j);
bo[(c div 10)mod 10]:=1;
end;
if (c div 1000)and(bo[c div 100]=0) then
begin
inc(j);
bo[c div 100]:=1;
end;
if j=9 then writeln(a,' ',b,' ',c);
end;
end.
var bo:array[1..9]of integer;
a,b,c,j:integer;
begin
for a:=123 to 329 do
begin
fillchar(bo,sizeof(bo),0);
j:=0;
b:=a*2;
c:=a*3;
if (a mod 100)and(bo[a mod 10]=0) then
begin
inc(j);
bo[a mod 10]:=1;
end;
if ((a div 10)mod 100)and(bo[(a div 10)mod 10]=0) then
begin
inc(j);
bo[(a div 10)mod 10]:=1;
end;
if (a div 1000)and(bo[a div 100]=0) then
begin
inc(j);
bo[a div 100]:=1;
end;
if (b mod 100)and(bo[b mod 10]=0) then
begin
inc(j);
bo[b mod 10]:=1;
end;
if ((b div 10)mod 100)and(bo[(b div 10)mod 10]=0) then
begin
inc(j);
bo[(b div 10)mod 10]:=1;
end;
if (b div 1000)and(bo[b div 100]=0) then
begin
inc(j);
bo[b div 100]:=1;
end;
if (c mod 100)and(bo[c mod 10]=0) then
begin
inc(j);
bo[c mod 10]:=1;
end;
if ((c div 10)mod 100)and(bo[(c div 10)mod 10]=0) then
begin
inc(j);
bo[(c div 10)mod 10]:=1;
end;
if (c div 1000)and(bo[c div 100]=0) then
begin
inc(j);
bo[c div 100]:=1;
end;
if j=9 then writeln(a,' ',b,' ',c);
end;
end.
将1-9这9个数字分成三组(每个数字只能使用一次)
将1-9这9个数子分成三组(每个数字只能使用一次),分别组成三个三位数,值构成1:2:3的比例
pascal编程:将1~9这9个数字分成三组(每个数字只能用一次),分别组成三个三位数.求大师讲解一下吧!
将1~9九个数字填入括号中,是算式成立(每个数字只能使用一次)
将1~9这9个数字分成三组(每个数字只能用一次),分别组成三位数,且这三个三位数的值构成1:2:3的比例.
将1~9这9个数字填入每行、每列、每个小九宫格,每个数字在每行、每列、每个小九宫.格中只能出现一次
将1~9这9个数字填入每行,每列,每个小九宫格,并且每个数字在每行,每列,每个小九宫.格中只能出现一次
将1~9这9个数字填入每行、每列、每个小九宫格,且每个数字在每行、每列、每个小九宫.格中只能出现一次
将1~9这9个数字填入每行、每列、每个小九宫格,并且每个数字在每行、每列、每个小九宫格中只能出现一次
用2 3 7 9 快算24 利用 加减乘除四则运算 每个数字只能使用一次,需要3个算式.
用1,2,3,4,5,6,7,8,9这九个数字,写出三个大小相等的分数,每个数字只能使用一次.
将1至9个数字填入每行、每列、每个小九宫格,并且每个数字在每行、每列、每个小九宫格中只能出现一次.