|
|
вернуться в форумWA 28 ??? Why WA 28?I don't understand. Here is my code: program gjkh; var a,b,ch,n,i,kol,sh,fir,sec,thi:longint; m:array[1..100001]of longint; flag:boolean; begin read(a);readln(b); n:=0; while not seekeof do begin read(ch); if (n=0)or(m[n]<>ch)then begin n:=n+1; m[n]:=ch; end; end; flag:=true; kol:=1; for i:=1 to n do begin if (i=1)then fir:=m[i] else begin if (flag=true)then begin sec:=m[i]; flag:=false; end else begin thi:=m[i]; if ((thi-sec)*(sec-fir)>0)then begin fir:=sec;sec:=thi; end else begin fir:=thi; kol:=kol+1; flag:=true; end; end; end; end; writeln(kol); end. Re: WA 28 ??? Послано r1d1 1 фев 2010 18:39 1 5 -100000 500000 -70000 800000 -80000 answ: 3 Edited by author 01.02.2010 18:44 Re: WA 28 ??? Input numbers must not exceed 100000 by absolute value. Re: WA 28 ??? why is 3, because there are 4 intervals? |
|
|