|
|
вернуться в форумWhy wrong answer C# using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ReverseRoot { class Program { static void Main(string[] args) { string line; string input = ""; double sqrt; while (!String.IsNullOrWhiteSpace(line = Console.ReadLine())) { input += " "; input += line;//but here it seems to be an infinite loop } if (Encoding.UTF8.GetBytes(input).Length / 1024 > 256) { Console.WriteLine("Sorry! Long Input Stream"); } else { string[] arr = input.Split(' '); for (int i = arr.Length - 1; i >= 0; i--) { if (!String.IsNullOrWhiteSpace(arr[i])) { sqrt = Math.Sqrt(Int64.Parse(arr[i])); if (sqrt == 0) Console.WriteLine(sqrt.ToString("0.0000")); else Console.WriteLine(sqrt.ToString("#.####")); } } } } } } |
|
|