Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 views
in Technique[技术] by (71.8m points)

c# - Runtime Error (NZEC) in simple code

I'm getting runtime error (NZEC) when running the following code over at SPOJ. I'd be very thankful if any of you would kindly point out what's going on.

//0<=A<=B<=10^18, 1<=N<=10^18
using System;
class any
{
static void Main()
 {
    long t = long.Parse(Console.ReadLine());
    ulong a, b, n;

    for(long k = 0; k < t; k++)
     {
        string[]s = Console.ReadLine().Split(' ');
        a = ulong.Parse(s[0]);
        b = ulong.Parse(s[1]);
        n = ulong.Parse(s[2]);
        Console.WriteLine(diviEntre2(a, b, n));
     }
 }
static ulong diviEntre2(ulong f, ulong c, ulong n)
{
   ulong k, s, m;

    if (f == c && c % n == 0 && f != 0) k = c/n;

    else
     {
      s = f/n;
      m = c/n;

      k = m - s;
     }

  return k;
}
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

NZEC stands for Non Zero Exit Code. For C users, this will be generated if your main method does not have a return 0; statement. Other languages like Java/C++ could generate this error if they throw an exception.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...