求PASCAL 语言的解题步骤,var a,b:array[0..2] of integer; i,j,tmp:integer; begin for i := 0 to 2 do read(b[i]); for i := 0 to 2 do begin a[i] := 0; for j := 0 to i do begin inc(a[i],b[j]); inc(b[a[i] mod 3],a[j]); end; end; tmp := 1; for i := 0
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/08 23:47:48
求PASCAL 语言的解题步骤,var a,b:array[0..2] of integer; i,j,tmp:integer; begin for i := 0 to 2 do read(b[i]); for i := 0 to 2 do begin a[i] := 0; for j := 0 to i do begin inc(a[i],b[j]); inc(b[a[i] mod 3],a[j]); end; end; tmp := 1; for i := 0
求PASCAL 语言的解题步骤,
var
a,b:array[0..2] of integer;
i,j,tmp:integer;
begin
for i := 0 to 2 do
read(b[i]);
for i := 0 to 2 do
begin
a[i] := 0;
for j := 0 to i do
begin
inc(a[i],b[j]);
inc(b[a[i] mod 3],a[j]);
end;
end;
tmp := 1;
for i := 0 to 2 do
begin
a[i] := a[i] mod 10;
b[i] := b[i] mod 10;
tmp := tmp * (a[i] + b[i]);
end;
writeln(tmp);
end.
输入:2 3 5
输出:_______
求PASCAL 语言的解题步骤,var a,b:array[0..2] of integer; i,j,tmp:integer; begin for i := 0 to 2 do read(b[i]); for i := 0 to 2 do begin a[i] := 0; for j := 0 to i do begin inc(a[i],b[j]); inc(b[a[i] mod 3],a[j]); end; end; tmp := 1; for i := 0
这是NOIP普及组第15届的一道题目,答案是416,需要注意的两点是a,b数组都是从0开始的,inc(b[a[i] mod 3], a[j]); 就是b[a[i] mod 3]:=b[a[i] mod 3]+a[j].其他的自己列两个表分别表示两个数组跟踪就行了,没什么难度.