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

Help!!!!!! Compilation Error
Posted by Jicote Aguamielero 21 Jul 2002 10:38
program combinat (input, output);
var
   pri: array[1..6000,1..2] of longint;
   EME, ENE, i, j, cont, numprim, aux:longint;
   qwe:boolean;

function PrimoNo(m:longint):boolean;
var
conP: longint;
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:=false
      else
         primono:= true;
end;

begin
readln(input, ENE, EME);
if ene<>0 then
begin
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 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
else writeln(output, 0);
end.
Small error. You got AC now.
Posted by I am david. Tabo. 21 Jul 2002 12:01
program combinat (input, output);
{$APPTYPE CONSOLE}
uses SysUtils;


var
   pri: array[1..6000,1..2] of longint;
   EME, ENE, i,k, j, cont, numprim, aux:longint;
   qwe:boolean;

function PrimoNo(m:longint):boolean;
var
conP: longint;
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:=false
      else
         primono:= true;
end;

begin
readln(input, ENE, EME);
if ene<>0 then
begin
pri[1,1]:=2;
numprim:=1;
for i:=2 to (2*((ene+2) div 2)+1) do
begin
   k:=i;
   k:=k+1;
   qwe:=primono(k);
   if qwe then
   begin
      numprim:=numprim+1;
      pri[numprim,1]:=k;
   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
else writeln(output, 0);
end.
Re: Small error. You got AC now.
Posted by Jicote Aguamielero 21 Jul 2002 12:09
> program combinat (input, output);
> {$APPTYPE CONSOLE}
> uses SysUtils;

Thanks, but... why do i need that? I don't have problems in my
computer.
Re: Small error. You got AC now.
Posted by I am david. Tabo. 21 Jul 2002 22:59
program combinat (input, output);
{$APPTYPE CONSOLE}
uses SysUtils;

sory for my bad English
the problms on timus runing on delphi and if you make so

  for example:

for i:=1 to n do
  i:=something or i which was in your problem. it is CE on delphi.

AC
  for i:=1 to n do
  begin
    ch:=i;
    and use ch exept i.
  end;

i run my programs on delphi.  in your compiuter you can write it or
no it is same to you.
Re: Small error. You got AC now.
Posted by Jicote Aguamielero 23 Jul 2002 03:04
Thank you very much.

Jicote.