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 1355. Bald Spot Revisited

Help! I got Compilation Error! But I don't Know Why?
Posted by TheBeet 28 Jul 2006 13:06
here is my code:
No Error...
var
  ti,tn,i,n,m,a,b:longint;

begin
  readln(tn);
  for ti:=1 to tn do
    begin
      readln(a,b);
      if ((b mod a)<>0) then begin writeln('0');continue;end;
      b:=b div a;
      m:=1;
      for i:=2 to trunc(sqrt(b)) do
        if ((b mod i)=0)
          then
            begin
              b:=b div i;
              m:=m+1;
              i:=i-1;
            end;
     if (b>1) then inc(m);
     writeln(m);
   end;
end.

Edited by author 28.07.2006 13:08
Re: Help! I got Compilation Error! But I don't Know Why?
Posted by TheBeet 28 Jul 2006 13:13
And if i change "i:=i-1;" to "{i:=i-1;}" I will got WA1.

var
ti,tn,i,n,m,a,b:longint;

begin
readln(tn);
for ti:=1 to tn do
begin
readln(a,b);
if ((b mod a)<>0) then begin writeln('0');continue;end;
b:=b div a;
m:=1;
for i:=2 to trunc(sqrt(b)) do
if ((b mod i)=0)
then
begin
b:=b div i;
m:=m+1;
{########i:=i-1;##########}
end;
if (b>1) then inc(m);
writeln(m);
end;
end.
Re: Help! I got Compilation Error! But I don't Know Why?
Posted by TheBeet 28 Jul 2006 13:19
I have got AC.
I just change "for" to "while".