求Pascal题解

P1112 波浪数

```cpp var a1,a2,a3,a4,a5,i,j,es:longint; ts:string; function jz(xx,yy:longint):string; var ss:string; dd:longint; begin ss:=''; repeat dd:=xx mod yy; if dd>9 then dd:=dd+55 else dd:=dd+48; ss:=chr(dd)+ss; xx:=xx div yy; until xx=0; jz:=ss; end; function bls(jc:string):boolean; var i:longint; begin bls:=true; for i:=3 to length(jc) do if (jc[i]<>jc[i-2])or(jc[i]=jc[i-1]) then begin bls:=false;break;end; if (jc[1]=jc[2])or(length(jc)<=2) then bls:=false; end; begin read(a1,a2,a3,a4,a5); for i:=a3 to a4 do begin es:=0; for j:=a1 to a2 do begin ts:=jz(i,j); if bls(ts) then inc(es); end; if es=a5 then writeln(i); end; end. 为毛超时了。。。 ```
by STL_233 @ 2017-08-02 14:17:45


@[MRF233](/space/show?uid=51034) 爆搜肯定超啊
by 夏色祭 @ 2017-08-19 16:26:01


|