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

Why is wrong answer? Help me PLS! [C#]
Posted by P@$h_0K 2 Jun 2008 22:59
Here is my code:

using System;
using System.Collections;
using System.IO;

namespace problem1001
{
    class mySolution
    {
        static void Main()
        {
            Stream myStream = Console.OpenStandardInput();
            Stack myNumbers = new Stack();
            string buffer = "";
            int temp;
            while (true)
            {
                temp = myStream.ReadByte();
                if (char.IsDigit((char)temp))
                    buffer += (char)temp;
                else
                {
                    if (buffer != "")
                    {
                        myNumbers.Push(double.Parse(buffer));
                        buffer = "";
                    }
                    if (temp == -1)
                        break;
                }
            }
            while (myNumbers.Count != 0)
            {
                Console.WriteLine("{0:f4}", Math.Sqrt((double)myNumbers.Pop()));
            }
        }
    }
}