Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Const M=1; N=3; G=5;
- Var P: array[M..N] of byte;
- Team: array[M..N] of string[20];
- X, s3 : string[20];
- i, L, R, K, s1,s2: integer;
- begin
- for i:=M to N do
- begin
- Team[i] := Char(64+i);
- P[i] := random(0,15)
- end;
- for i:=1 to 3 do
- begin
- s1:= random(1,N);
- s2:= random(1,N);
- s3:= Team[s1];
- Team[s1] := Team[s2];
- Team[s2] := s3;
- end;
- write(Team);
- Write ('Введите названия команды:'); Readln(X);
- L:=M; R:=N;
- while ((R-L)>0) do
- begin
- K:=(R+L) div 2;
- if (X<=Team[K]) then R:=K else L:=K+1
- end;
- if (X=Team[R]) then Writeln(x,' имеет', P[R],' очков')
- else Writeln(X,' нет такой команды');
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement