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 1091. Tmutarakan Exams

why my code always be "Compilation error"
Posted by chinacn 30 Nov 2007 16:51
please help me!thank you very much.
program p1091;
var
 s,i,k,j:longint;
 yy:longint;
 yinzi:array[1..1000] of longint;
 first:boolean;
 lyy,total:int64;
function c(y,x:longint):int64;
var
 i:longint;
 i1,x1:int64;
begin
 c:=1;
 x1:=x;
 for i:=(x+1) to y do
 begin
  i1:=i;
  c:=c*i1;
  c:=c div (i1-x1);
 end;
end;
begin
  readln(k,s);
  i:=2;
  while (s div i>=k) do
  begin
    fillword(yinzi,sizeof(yinzi) shr 1,0);
    first:=false;
    yy:=i;
    for j:=2 to i do
    while ((yy mod j)=0) and (yy>0) do
    begin
      inc(yinzi[j]);
      if yinzi[j]>1 then first:=true;
      yy:=yy div j;
    end;
    if not(first) then
    begin
      yy:=0;
      for j:=2 to 30 do
       inc(yy,yinzi[j]);
      if odd(yy) then begin
                        lyy:=c(s div i,k);
                        inc(total,lyy);
                      end
      else begin
             lyy:=c(s div i,k);
             dec(total,lyy);
           end;
    end;
    inc(i);
  end;
  if total>10000 then writeln('10000')
  else writeln(total);
end.
Re: why my code always be "Compilation error"
Posted by KIRILL(ArcSTUpid coder:) 30 Nov 2007 19:24
use result:=result*i1 instead of c:=c*i1;
and fillchar() instead of fillword()