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

Someone passed this task using C#?
Posted by Vecktor 19 Apr 2008 13:20
I successfuly passed it on Pascal... But i can't do it in C#...  3 Test WA!!!! I used "en-US" format (for example 5.0432). If someone did it please tell what can be wrong....
using System;
using System.Text;
using System.IO;
using System.Threading;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Globalization.CultureInfo local = new System.Globalization.CultureInfo("en-US");
            long count = -1;
            long[] In = new long[1000000];
            int ChrSt;
            string StrIn;
            string StrSt = "";
            while ((ChrSt=Console.In.Read())>0)
            {
                if ((ChrSt >= '0') && (ChrSt <= '9'))
                    StrSt += (char)ChrSt;
                else
                {
                    if (StrSt != "")
                    {
                        count++;
                        long.TryParse(StrSt, out In[count]);
                        StrSt = "";
                    }
                }
            }

            for (long i = count; i > -1; i--)
            {

                Console.WriteLine(Math.Sqrt(In[i]).ToString("0.0000",local));
            }
        }
    }
}