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 1157. Young Tiler

I DON'T KNOW WHY I GOT WA???HELP~~~~~PLS~~~~~
Posted by windy 28 May 2003 19:14
program windy;
    var
      n,i,m,k,j,n1,n2:longint;
      c:boolean;
    begin
      readln(m,n,k);
      c:=true;
      i:=k+1;
      while c and (i<=10000) do
        begin
          n1:=0;
          n2:=0;
          for j:=2 to trunc(sqrt(i)) do
            begin
              if i mod j=0 then n1:=n1+1;
              if (i-k) mod j=0 then n2:=n2+1;
            end;
          if (n1+1=n) and (n2+1=m) then c:=false
            else i:=i+1;
         end;
       if c then writeln(0);
       if not c then writeln(i)
     end.