Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type massiv = array[1..1000] of byte;
- var a : massiv;
- i, j, n, sc, sc2, ot, k, e, r, e2 : integer;
- t1, t2 : boolean;
- begin
- readln(n);
- for i := 1 to n do
- begin
- write('a[', i ,'] = ');
- read(a[i]);
- end;
- for i := 1 to n do
- if a[i] = 0 then
- begin
- j := i;
- sc := 0;
- repeat
- inc(j);
- inc(sc);
- if (j = n) and (a[j] <> 0) then
- begin
- sc := 1;
- break;
- end;
- until a[j] = 0;
- dec(sc);
- if sc2 < sc then
- begin
- sc2 := sc;
- ot := i + 1;
- k := j - 1;
- end;
- end;
- writeln(ot, ' ', k, ' - samii boliwoi ostrovok');
- for i := ot to k do
- if a[i] > e then
- begin
- e := a[i];
- r := i;
- end;
- writeln(e : 3, r : 3);
- e2 := e;
- if ot + 1 = r then
- begin
- if a[ot] < e2 then t1 := true;
- end
- else
- for i := r-1 downto ot+1 do
- begin
- if a[i]< e2 then e2 := a[i];
- if a[i-1]< e2 then t1 := true;
- end;
- e2 := e;
- if r+1 = k then
- begin
- if a[k] < e2 then t2 := true;
- end
- else
- for i := r+1 to k-1 do
- begin
- if a[i] < e2 then e2 := a[i];
- if a[i+1]< e2 then t2 := true;
- end;
- if t1 and t2 then writeln('gora');
- writeln(t1);
- writeln(t2);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement