Hej, mam problem z tym zadaniem, mianowicie przy wysyłaniu rozwiązania SPOJ wyrzuca mi ciągle błąd NZEC. Gdzie mogę mieć błąd? Oto kod:
using System;
using System.Collections.Generic;
public class Test
{
public static void Main()
{
long n = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < n; i++)
{
int num_bin = Convert.ToInt32(Console.ReadLine());
List<long> bits = new List<long>();
while(num_bin!=0)
{
bits.Add(num_bin % 10);
num_bin /= 10;
}
List<long> bits_odd = new List<long>();
List<long> bits_even = new List<long>();
for(int k=0;k<bits.Count;k++)
{
if (k % 2 == 0)
bits_even.Add(bits[k]);
else
bits_odd.Add(bits[k]);
}
long sum_odd=0;
long sum_even=0;
for(int l=0;l<bits_odd.Count;l++)
{
sum_odd += bits_odd[l]*(long)Math.Pow(-1,l);
}
for (int m = 0; m < bits_even.Count; m++)
{
sum_even += bits_even[m]*(long)Math.Pow(-1, m);
}
long res = 2 * sum_odd + sum_even;
if (res%5 == 0 && bits[0] == 0)
Console.WriteLine("Tak");
else
Console.WriteLine("Nie");
}
}
}