fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. long n = Convert.ToInt32(Console.ReadLine());
  9. for (int i = 0; i < n; i++)
  10. {
  11. int num_bin = Convert.ToInt32(Console.ReadLine());
  12. List<long> bits = new List<long>();
  13. while(num_bin!=0)
  14. {
  15. bits.Add(num_bin % 10);
  16. num_bin /= 10;
  17. }
  18. List<long> bits_odd = new List<long>();
  19. List<long> bits_even = new List<long>();
  20. for(int k=0;k<bits.Count;k++)
  21. {
  22. if (k % 2 == 0)
  23. bits_even.Add(bits[k]);
  24. else
  25. bits_odd.Add(bits[k]);
  26. }
  27. long sum_odd=0;
  28. long sum_even=0;
  29. for(int l=0;l<bits_odd.Count;l++)
  30. {
  31. sum_odd += bits_odd[l]*(long)Math.Pow(-1,l);
  32. }
  33. for (int m = 0; m < bits_even.Count; m++)
  34. {
  35. sum_even += bits_even[m]*(long)Math.Pow(-1, m);
  36. }
  37. long res = 2 * sum_odd + sum_even;
  38. if (res%5 == 0 && bits[0] == 0)
  39. Console.WriteLine("Tak");
  40. else
  41. Console.WriteLine("Nie");
  42. }
  43. }
  44. }
Runtime error #stdin #stdout #stderr 0s 134848KB
stdin
1
100101010101101
stdout
Standard output is empty
stderr
Unhandled Exception:
System.OverflowException: Value was either too large or too small for an Int32.
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00066] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Int32.Parse (System.String s, System.IFormatProvider provider) [0x00008] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Convert.ToInt32 (System.String value) [0x0000e] in <8f2c484307284b51944a1a13a14c0266>:0 
  at Test.Main () [0x00018] in <7063072131f64799992b53610d6034b2>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.OverflowException: Value was either too large or too small for an Int32.
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00066] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Int32.Parse (System.String s, System.IFormatProvider provider) [0x00008] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Convert.ToInt32 (System.String value) [0x0000e] in <8f2c484307284b51944a1a13a14c0266>:0 
  at Test.Main () [0x00018] in <7063072131f64799992b53610d6034b2>:0