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

Please 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 ???
Posted by williamljb 25 Jul 2009 19:56
add these and get AC:
  "if a[j]>0 then......"