I get WA on every problem i submit in pascal.
Please somebody look my source code for this problem
{#10049 Self-Describing Sequence}, compile it, run it and test it. I think my output is correct. Please heeeeelp me
Code: Select all
{#10049 Self-Describing Sequence}
program sequence;
const n=673365;
var t:array[1..n] of longint;
i,j,k,pos:longint;
begin
t[1]:=1;
t[2]:=3;
i:=3;
j:=3;
pos:=1;
repeat
for k:=pos to n do if i<=t[k+1] then begin
t[j]:=t[j-1]+k+1;
pos:=k;
break;
end;
inc(i);
inc(j);
until i>n;
repeat
readln(k);
for i:=1 to n do if t[i]>=k then begin
writeln(i);
break;
end;
until k=0;
end.