|
|
back to boardPlease help me my algorithm is short and obvious but i don know why it get WA ??? Posted by Saber 18 Mar 2003 21:35 here is my prog : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const maxn=10000; var n,i,j,s,k : integer; a : array[0..maxn] of integer; begin readln(n,s); fillchar(a,sizeof(a),0);a[s]:=1; for i:=s+1 to n do for j:=s to i-1 do if (i-j)*100 mod j = 0 then begin if a[j]+1>a[i] then a[i]:=a[j]+1; end; k:=0; for i:=s to n do if a[i]>k then k:=a[i]; writeln(k); end. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SABER ssf_digi@hotmail.com Re: Please help me my algorithm is short and obvious but i don know why it get WA ??? add these and get AC: "if a[j]>0 then......" |
|
|