ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1138. Integer Percentage

Why my program get WA?I can't find the mistake.
Posted by Sarby Liang 19 Aug 2004 17:20
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.
Posted by williamljb 25 Jul 2009 19:57
add these:
  "if f[i]>0 then......"
Re: Why my program get WA?I can't find the mistake.
Posted by Dark Chou 2 Sep 2009 19:30
Thanks.
I make a mistake here,too.
Re: Why my program get WA?I can't find the mistake.
Posted by fredAC 19 Oct 2009 09:31
many thanks,
mistake here too