Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- n,i,j,max,s,p,g:longint;
- a : array[1..1000] of longint;
- begin
- ReadLn(RandSeed, n);
- for i:=1 to n do
- begin
- a[i]:=5-Random(11);
- end;
- max:=0;
- for i:=1 to n do
- begin
- s:=0;
- for j:=i to n do
- begin
- s:=s+a[j];
- if s > max then
- begin
- p:=i;
- g:=j;
- max:=s;
- end;
- end;
- end;
- writeln(p,' ',g,' ',max);
- if n<10 then
- begin
- for i:=1 to n do
- begin
- if i<>n then write(a[i],' ')
- else write(a[i]);
- end;
- end;
- readln;
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement