12 / 12
Apr 2010

I do factorial problem and can run with test 10^9(max) in free pascal ver 0.9.2 but when i submit it i have NZEC error. Please help me

Runtime error 5 at $08059477
  $08059477
  $08059539

Doesn't sound too good stuck_out_tongue

Sorry but can you check it again ?
I have run that again and no problem occur ?
the answere of "1000000000" is "249999998", isn't it ?
Please tell me version i use have any problem ?
And number of test of spoj ?

const fi='test.inp';
fo='test.out';
...
assign(f,fi);
assign(ft,fo);

Could it be that you try to read/write from files instead od stdin/out..?

Oh that's may be new with me. I work with Borland Pascal for a long time so i only know use these code in free pascal and ctrl+F9.
Can you tell me more specific "stdin/out" , My english is very bad , and i am newbie in informatics .

Oh sorry all for annoyed.
My friends show me how to submit a solution. The test isn't in file .
Sorry again.
Admin can blocked my fool topic smile

4 years later

HI, im new to this and was wondering if someone could help me figure out what´s wrong with my code since every time y submit it i get the NZEC error. Its written in pascal. Thank you very much.

program readfile;
uses
crt,dos;
var
a,b,c:integer;
input,output:text;
begin
clrscr;
assign(input, 'c:\input.txt');
reset(input);
assign(output, 'c:\output.txt');
rewrite(output);
readln(input,a);
readln(input,b);
c:=a+b;
write(output,c);
close(input);
close(output);
end.

Welcome to SPOJ!

Are you trying to solve one of the specific problems or just trying out some Pascal? If the former, then which problem? If the latter, then I suggest using ideone.com, as it's a compiler, the NZEC is given because your code aborted abnormally.

In the case of this code, the file input.txt doesn't exist on the spoj server. All input is read from the standard input, not files.

If you have more questions, feel free to post back. Many here would be glad to answer them.

Hi Leppy,

Im trying to solve the problem 3032 ADUN using dev-pascal 1.9.2. How do I read from the standard input? or does standard input mean you have to type in the data? I know some matlab, maybe i should change the language to matlab, or c++.

thanks

If you're using windows, then your file should compile into an executable, once you've done that you execute the file like so:
Test.exe test.out

That will redirect the input from test.in, and place the output in test.out

If you're using a uniz environment, then google redirect stdin.

i've never used matlab, but most users here use c/c++ or java. I use some c# as well depending on where I am.

Leppy,

I tried what you said but it aint working.
maybe its too much to ask, but could you write the solution to the problem 3032 ADUN (in pascal) , then check if upon submission you get a wright answer and post the code here so i can see it. The problem is vey easy so it wont take long.

thanks

I think it would be better for you to try the problem TEST. The code for it is already written in this forum. It is stickied at the top.