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

Common Board

Jicote Aguamielero Help! I have ComplationError . Problem 1055 21 Jul 2002 10:15
program combinat;
var
   pri: array[1..6000,1..2] of integer;
   EME, ENE, i, j, cont, numprim, aux, qwe:integer;

function PrimoNo(m:integer):integer;
var
conP: integer;
begin
   j:=0;
   repeat
      j:=j+1;
until ((m mod pri[j,1])=0) or (pri[j,1]>sqrt(m)) or (j=numprim);
   if (m mod pri[j,1])=0 then primono:=0
      else
         primono:=1;
end;

begin
readln(input, ENE, EME);
pri[1,1]:=2;
numprim:=1;
for i:=2 to (2*((ene+2) div 2)+1) do
begin
   i:=i+1;
   qwe:=primono(i);
   if qwe=1 then
   begin
      numprim:=numprim+1;
      pri[numprim,1]:=i;
   end;
end;
   for i:=1 to numprim do
   begin
     aux:=pri[i,1];
   repeat
pri[i,2]:=pri[i,2]+(ene div aux);
pri[i,2]:=pri[i,2]-(eme div aux)-((ene-eme) div aux);
aux:=aux*pri[i,1];
   until ene div aux =0;
   end;
   cont:=0;
   for i:=1 to numprim do
      if pri[i,2]<>0 then cont:=cont+1;
   writeln(output, cont);
end.