Раунд 311.Задача В.

Revision ru2, by rus100, 2015-07-05 18:44:12

Попробывал решить задачу B из раунда 311.Решить решил.Проходит на мною придуманных тестах.Вот код:

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

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            string str1 = Console.ReadLine();
            string str2 = Console.ReadLine();
            int n = 0;
            double w = 0;
            string[] strin1 = str1.Split(' ');
            string[] strin2 = str2.Split(' ');
            n = int.Parse(strin1[0]);
            w = double.Parse(strin1[1]);
             double[] cups=new double[2*n];
             for (int i = 0; i <2*n; i++) {
                 cups[i] = double.Parse(strin2[i]);
             }
             double min = cups[0];
             for (int i = 0; i < 2*n; i++)
             {
                 if (cups[i] <= min)
                 {
                     min = cups[i];
                 }
             }
           
             for (int i = 0; i <2*n; i++) {
                 for (int j = i; j <2*n; j++) {
                     if (cups[i] > cups[j]) 
                     { 
                         double c = cups[i];
                     cups[i] = cups[j];
                     cups[j] = c; }
                    
                 }
             }
             double w1 = 0;
                     
                     if (cups[n] > 2 * min)
                     {
                         w1 = min * n * 3;

                     }
                     else {  
                         w1 = cups[n] * n*1.5;}

                     if (w1 > w) {
                         w1 = w;
                     }
             Console.WriteLine(String.Format("{0:0.000000}", w1));
            Console.ReadLine();
        }
    }
}

А теперь глупый вопрос.Почему несмотря на строку String.Format("{0:0.000000}", w1), у меня ответы выводятся с запятой? Прошу извинить за столь глупый вопрос.

Tags глупый вопрос

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru2 Russian rus100 2015-07-05 18:44:12 2 Мелкая правка: ' с запятой.\nПрошу из' -> ' с запятой?\nПрошу из'
ru1 Russian rus100 2015-07-05 18:43:28 2058 Первая редакция (опубликовано)