编程题

Program exp4(input,output);

Const N=3;

VAR I,J,S,X :integer;

P :array[0..n 1] of integer;

G :array[0..100] of integer;

Begin

For I := 0 to 100 do G[I]:=0;

P[0]:=0; P[n 1]:=100;

For I:= 1 to n do read (P[I]); readln;

For I:= 0 to n do

For J:= I 1 to N 1 do

G[abs(P[J]-P[I])]:=G[abs(P[J]-P[I])] 1;

S:=0;

For I:=0 to 100 do

If G[I]>0 then begin

Write(I,:4); S:=S 1;

End;

Writeln;

writeln(‘S=’,S);

Writeln(‘input data:’); readln(X);

Writeln(G[x])

End.

输入:10 20 65

input data: 10

输出:

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论