Peak Detection by uru

var a:array[1..99]of word;i,j,k,l,m,t,x:word;\x0d
begin\x0d
{$I-}repeat Inc(i);readln(a[i])until Ioresult<>0;\x0d
WriteLn(a[1]);\x0d
for j:=2to i-1do begin\x0d
m:=0;x:=a[j];\x0d
for k:=j+1to i-1 do if x-a[k]>9then begin m:=1;break end;\x0d
if m=1then for l:=j-1downto 1 do if x-a[l]>9then begin m:=2;break end;\x0d
if m=2then for t:=l to k do if a[t]>x then m:=3;\x0d
if m=2then WriteLn(x,'*') else WriteLn(x);\x0d
end end.

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page