Why my program get WA?I can't find the mistake.
program ural1138;
var
i,ans,n,s:integer;
f:array[1..10000] of integer;
procedure dp;
var i,j:integer;
begin
f[s]:=1;
for i:=s to n-1 do
for j:=1 to 100 do
if ((i*j) mod 100=0)and(i+(i*j) div 100<=n)
then if f[i]+1>f[i+(i*j) div 100]
then f[i+(i*j) div 100]:=f[i]+1
end;
begin
readln(n,s);
dp;
ans:=0;
for i:=n downto s do if f[i]>ans then ans:=f[i];
writeln(ans)
end.
Re: Why my program get WA?I can't find the mistake.
add these:
"if f[i]>0 then......"
Re: Why my program get WA?I can't find the mistake.
Thanks.
I make a mistake here,too.
Re: Why my program get WA?I can't find the mistake.
Послано
fredAC 19 окт 2009 09:31
many thanks,
mistake here too