开发者

Why do I get a NZEC error?

I'm working in Pascal, I don't understand why I'm getting an NZEC (Non Zero Exit Code) error when I'm submitting my problem. On my PC it works perfectly. Can you give me your opinion please?

program super_factor_sum;
var k,i,j,s:longint;   f,g:text;

function prim(x:integer):boolean; var d:longint;
begin
prim:=true;
for d:=2 to x div开发者_JS百科 2 do if x mod d=0 then prim:=false;
end;

begin assign(f,'input.txt'); reset(f); assign(g,'output.txt'); rewrite(g);
while not eof(f) do
begin readln(f,k);  s:=0;  i:=2;
      while (k<>1) or (i<=k) do
            begin if (prim(i)) and (k mod i=0) then
                       begin j:=0;
                             repeat k:=k div i; j:=j+1;
                             until k mod i<>0;
                             s:=s+i*j; i:=i+1;
                       end
                             else i:=i+1;
            end;
      write(s);   writeln(g,s);
end;
close(f);  close(g);
end.


Avoid NZEC error in Erlang in SPOJ

"module name always has to be tested and the entry point should be function main . For example, after compilation it should be run as tested:main()"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜