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 1055. Combinations

Why WA?
Posted by msi 22 May 2003 17:59
var
n,m,chet: longint;
k,l,i: longint;
begin
readln(n,m);
if (m=n) or (m=0) or (m>n) then writeln('0') else begin
if (n-m)<m then begin k:=m; m:=n-m; end else k:=n-m;
repeat
k:=k+1;
l:=k;
i:=1;
 repeat
 i:=i+1;
  repeat
  if (l mod i)=0 then begin l:=l div i; chet:=chet+1; end;
  until (l mod i)>0;
 until (i=k) or (l=1);
{writeln(k, chet);     }
until k=n;
k:=1;
repeat
k:=k+1;
if k<(m+1) then begin
l:=k;
i:=1;
 repeat
 i:=i+1;
  repeat
  if (l mod i)=0 then begin l:=l div i; chet:=chet-1; end;
  until (l mod i)>0;
 until (i=k) or (l=1);
{writeln(k,' ', chet);    }
end;
until k>=m;
writeln(chet);                       end;
end.