SPOJ中的NZEC错误

时间:2013-12-31 14:10:03

标签: java

为什么我粘贴此代码时会在SPOJ中收到运行时NZEC错误?

using System;

public class Test
{
    public static void Main(string[] args)
    {
        int t = int.Parse(Console.ReadLine());

        while (t < 1 || t > 100)
        {
            t = int.Parse(Console.ReadLine());
        }

        string[] words = new string[t];

        for (int i = 0; i < t; i++)
        {
            string word = Console.ReadLine();
            while (word.Length > 100 || word.Length < 1)
            {
                word = Console.ReadLine();
            }
            words[i] += word; 
        }


        foreach (var item in words)
        {
            for (int i = 0; i < item.Length / 2; i+=2)
            {
                Console.Write(item[i]);
            }
            Console.WriteLine();                
        }

    }        
}

我已经尝试了我能想到的每一个输入,它运行良好。什么可以使这抛出一个非零错误?提前谢谢。

1 个答案:

答案 0 :(得分:2)

您无法在包中放置SPOJ提交,因此请删除声明:

package spoj.test;

非零退出代码可能来自JVM无法加载类来运行它。

相关问题