fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int[] data = new int[] { 1, 2, 0, 3, 4, 5, 6, 7, 0, 8, 9 };
  8.  
  9. bool is_multiplied = false;
  10. long result = 0;
  11.  
  12. int index = 0;
  13. while (index < data.Length)
  14. {
  15. if (data[index] == 0)
  16. {
  17. is_multiplied = !is_multiplied;
  18.  
  19. if (!is_multiplied)
  20. {
  21. break;
  22. }
  23.  
  24. result = 1;
  25. }
  26. else
  27. {
  28. if (is_multiplied)
  29. {
  30. result *= data[index];
  31.  
  32. }
  33. }
  34.  
  35. index++;
  36. }
  37.  
  38. Console.WriteLine(result);
  39. }
  40. }
Success #stdin #stdout 0.02s 16116KB
stdin
Standard input is empty
stdout
2520