Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## WTF?为甚麽我对拍了1..1500所有n都过结果还是WA

Posted by Hoblovski at 2014-04-17 14:53:15 on Problem 1338
```然后把自己的结果拿来打表就A了啊...

O(n^2) WA代码
program poj1338;

var q:array[0..1517] of int64;
frt,rer,n:longint;

function binfind(n:int64):longint;
var l,r,mid:longint;
begin
l:=1; r:=rer+1; while l<>r do begin
mid:=(l+r)>>1;
if q[mid]<n then l:=mid+1 else
if q[mid]>n then r:=mid
else exit(0);
end; if (q[l]<=n)or(l>1500) then exit(0) else exit(l);
end;

procedure insert(s,v:longint);
var j:longint;
begin
for j:=rer+1 downto s+1 do q[j]:=q[j-1]; q[s]:=v;
if rer<1500 then inc(rer);
end;

procedure init;
var i:longint;
begin
fillchar(q,sizeof(q),\$3f);
q[1]:=1; frt:=0; rer:=1;
while frt<rer do begin
end;
end;

procedure work;
var i,j,k:longint;
begin
while not seekeof do begin
if n=0 then break;
writeln(q[n]);
end;
end;

begin
init;
work;
end.```

Followed by: