Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses crt;
- var
- a:array[0..100000000] of longint;
- i,n,c,s,tmp,max:longint;
- procedure solve();
- begin
- a[0]:=-2147483648;
- for i:=1 to n do
- begin
- read(a[i]);
- if a[i] >= a[i-1] then inc(tmp)
- else
- begin
- if tmp>=2 then inc(c);
- tmp:=1;
- end;
- if tmp>max then
- begin
- max:=tmp;
- s:=i-max+1;
- end;
- end;
- readln();
- end;
- procedure display();
- begin
- writeln('Co ',c,' day con lon hon mot phan tu!');
- if c>=1 then
- begin
- writeln('Day con lon nhat la:');
- for i:=s to s+max-1 do write(a[i],' ');
- end;
- end;
- begin
- clrscr();
- readln(n);
- solve();
- display();
- readln();
- end.
Advertisement
Add Comment
Please, Sign In to add comment