fork download
  1. using System;
  2.  
  3. namespace ConsoleApp17
  4. {
  5. internal class Program
  6. {
  7. private static void Main(string[] args)
  8. {
  9. int n = Convert.ToInt32((Console.ReadLine()));
  10. int[] arr = new int[n];
  11. int k;
  12.  
  13. int val = 0;
  14. for (int i = 0; i < n; i++)
  15. {
  16. arr[i] = Convert.ToInt32((Console.ReadLine()));
  17. }
  18. k = Convert.ToInt32((Console.ReadLine()));
  19.  
  20. for (int i = 0; i < n - k + 1; i++)
  21. {
  22. val = arr[i];
  23. for (int j = i; j < i + k; j++)
  24. {
  25. if (val < arr[j])
  26. {
  27. val = arr[j];
  28. }
  29. }
  30.  
  31. Console.Write(val + " ");
  32. }
  33. }
  34. }
  35. }
Runtime error #stdin #stdout #stderr 0.03s 20120KB
stdin
9
1 2 3 1 4 5 2 3 6
3
stdout
Standard output is empty
stderr
Unhandled Exception:
System.FormatException: Input string was not in a correct format.
  at System.Number.ThrowOverflowOrFormatException (System.Boolean overflow, System.String overflowResourceKey) [0x0001a] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Number.ParseInt32 (System.ReadOnlySpan`1[T] value, System.Globalization.NumberStyles styles, System.Globalization.NumberFormatInfo info) [0x00016] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Int32.Parse (System.String s, System.IFormatProvider provider) [0x00017] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Convert.ToInt32 (System.String value) [0x0000b] in <6649516e5b3542319fb262b421af0adb>:0 
  at ConsoleApp17.Program.Main (System.String[] args) [0x00024] in <66ba6913f28548e9a4165d6c1080ad8d>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.FormatException: Input string was not in a correct format.
  at System.Number.ThrowOverflowOrFormatException (System.Boolean overflow, System.String overflowResourceKey) [0x0001a] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Number.ParseInt32 (System.ReadOnlySpan`1[T] value, System.Globalization.NumberStyles styles, System.Globalization.NumberFormatInfo info) [0x00016] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Int32.Parse (System.String s, System.IFormatProvider provider) [0x00017] in <6649516e5b3542319fb262b421af0adb>:0 
  at System.Convert.ToInt32 (System.String value) [0x0000b] in <6649516e5b3542319fb262b421af0adb>:0 
  at ConsoleApp17.Program.Main (System.String[] args) [0x00024] in <66ba6913f28548e9a4165d6c1080ad8d>:0