fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Program
  5. {
  6. static void Main(string[] args)
  7. {
  8. int ileLiczb42 = 0;
  9. string[] daneWejscia = new string[500];
  10. string wejscie = "";
  11. string[] dane2;
  12. for (int i = 0; ; i++)
  13. {
  14. wejscie = Console.ReadLine();
  15. daneWejscia[i] = wejscie;
  16. dane2 = daneWejscia.Where(c => c != null).ToArray();
  17. if (ileLiczb42 < 3)
  18. {
  19. if (dane2.Length > 1)
  20. {
  21. if (daneWejscia.Length > 2)
  22. {
  23. if (ileLiczb42 != 3)
  24. {
  25. if ((dane2[dane2.Length - 2] != "42") && wejscie == "42")
  26. {
  27. ileLiczb42 += 1;
  28. Console.WriteLine(daneWejscia[i]);
  29. if (ileLiczb42 == 3)
  30. {
  31. Environment.Exit(1);
  32. }
  33. }
  34. else
  35. {
  36. Console.WriteLine(daneWejscia[i]);
  37. }
  38. }
  39.  
  40. }
  41. }
  42. else
  43. {
  44. Console.WriteLine(daneWejscia[i]);
  45. }
  46. }
  47. }
  48. }
  49. }
  50.  
  51.  
Runtime error #stdin #stdout #stderr 0.04s 21652KB
stdin
Standard input is empty
stdout



















































































































































































































































































































































































































































































































stderr
Unhandled Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at (wrapper stelemref) System.Object.virt_stelemref_sealed_class(intptr,object)
  at Program.Main (System.String[] args) [0x00021] in <f0c84fed43e645c98933365cf6b828bd>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at (wrapper stelemref) System.Object.virt_stelemref_sealed_class(intptr,object)
  at Program.Main (System.String[] args) [0x00021] in <f0c84fed43e645c98933365cf6b828bd>:0