• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Hw

a guest Jan 28th, 2020 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. Const M=1; N=16; G=5;
2. Var P: array[M..N] of byte;
3. Team: array[M..N] of string[20];
4. X, s3 : string[20];
5. i, j, L, R, K, s1,s2: integer;
6. begin
7. for i:=M to N do
8. begin
9. Team[i] := Char(64+i);
10. P[i] := random(0,15)
11. end;
12. for i:=1 to G do
13. begin
14. s1:= random(1,N);
15. s2:= random(1,N);
16. s3:= Team[s1];
17. Team[s1] := Team[s2];
18. Team[s2] := s3;
19. end;
20. writeln('Перемешанный массив ',Team);
21.
22. for i:=1 to N-1 do
23.   for j:=1 to N-i do
24.     if Team[j][1] > Team[j+1][1] then begin
25.       s3 := Team[j];
26.       Team[j] := Team[j+1];
27.       Team[j+1] := s3;
28.     end;
29. writeln('Отсортированный массив ',Team);
30. Write ('Введите названия команды:'); Readln(X);
31.
32. L:=M; R:=N;
33. while ((R-L)>0) do
34. begin
35. K:=(R+L) div 2;
36. if (X=Team[K]) then begin R:=K; break; end;
37. if (X<Team[K]) then R:=K else L:=K+1
38. end;
39. if (X=Team[R]) then Writeln(x,' имеет ', P[R],' очков')
40. else Writeln(X,'  нет такой команды');
41.
42. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top