不是VIP会员,不能显示答案

题目解答

题目:
program test4;
var
t,x,i,j:integer;
f:boolean;
a:array[1..10] of integer;
begin
readln(x);
for i:=1 to 10 do read(a[i]);
for i:=1 to 9 do
for j:=i+1 to 10 do
if a[i]<a[j] then
begin
t:=a[i];a[i]:=a[j];a[j]:=t;
end;
i:=0;f:=false;
repeat
i:=i+1;
if x=a[i] then f:=true;
until (i=10) or (f=true);
if f=true then writeln(i) else writeln('not found!');
end.
输入:
12
12 23 45 6 1 2 3 4 10 21

输出:4
考点:
分析:
解答:
评论:
老师: