ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

Where is the problem(1001 C#)
Posted by PM_2004 8 Jul 2008 15:57
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace Timus1081
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Run(Console.In, Console.Out);
            //new Program().Run(new StreamReader(@"d:\a.txt"), Console.Out);
            //Console.ReadLine();
        }

        private void Run(System.IO.TextReader textReader, System.IO.TextWriter textWriter)
        {
            string[] ss = textReader.ReadToEnd().Split();
            //string ss = input.Split('\n');

            List<double> bs = new List<double>();

            for (int i = 0; i < ss.Length; i++)
            {
                if (ss[i].Trim().Length > 0)
                {
                    //string[] s1 = ss[i].Trim().Split(' ');
                    //for (int j = 0; j < s1.Length; j++)
                    {
                        try
                        {
                            bs.Add(Math.Sqrt(Double.Parse(ss[i])));
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
            }

            for (int i = bs.Count - 1; i >= 0; i--) textWriter.WriteLine(bs[i].ToString("F4"));
        }

    }
}