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 1248. Sequence Sum

Why i don't get AC?
Posted by novopashinwm 4 Mar 2015 19:48
This is my programm below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace _1248
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            double s = 0;
            for (int i = 0; i < n; i++)
            {
                string strS = Console.ReadLine();
                double ch =0;
                if (strS.Contains("e"))
                {
                    string[] arr = strS.Split('e');
                    double ss = double.Parse (arr[1]);
                    ch = double.Parse(arr[0], CultureInfo.InvariantCulture) *  Math.Pow(10, ss);
                }
                else
                    ch = double.Parse  (strS );

                s +=ch;
            }

            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("{0:0.000000000000000000e0}", s);
            string sss = sb.ToString();
            sss = sss.Replace(',', '.');
            //sss = sss.Replace("e0", "");
            Console.WriteLine(sss);
        }
    }
}