- 花匠
- 2014-04-10 15:14:24 @
program flower;
var ans,i,j,k,n,m:longint;
a,h:array[0..100000] of longint;
procedure datain;
begin readln(n); for i:=1 to n do read(h[n]); end;
procedure data;
var i,j,k:longint;
begin fillchar(a,sizeof(a),0); m:=1; for i:=2 to n do if h[i-1]=h[i] then begin h[i-1]:=0; inc(m); end; if m=n then begin write(1);halt;end; ans:=2;k:=1; for i:=1 to n do if h[i]<>0 then begin a[k]:=h[i]; inc(k);end; for i:=2 to n-1 do if ((a[i-1]<a[i]) and (a[i]>a[i+1])) or ((a[i-1]>a[i])and (a[i]<a[i+1])) then inc(ans); writeln(ans); end;
begin
datain; data; end.
问一下哪里错了~
0 条评论
目前还没有评论...
信息
- ID
- 1845
- 难度
- 6
- 分类
- (无)
- 标签
- 递交数
- 4343
- 已通过
- 1237
- 通过率
- 28%
- 被复制
- 9
- 上传者