提出 #39236592


ソースコード 拡げる

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

namespace xxx
{
    internal class Program
    {
        static void Main(string[] args)
        {
            AL.SetCase();
            int N = AL.ReadInt();
            int[] xs = AL.ReadIntArray();
            Array.Sort(xs);
            var segment = new ArraySegment<int>(xs, N, N * 3);
            var sum = segment.Sum();

            Console.WriteLine((double)(sum)/(N*3));
        }
    }
    static class AL
    {
        public static void SetCase()
        {
#if DEBUG
            Console.WriteLine("Case?");
            var name = Console.ReadLine();
            if (string.IsNullOrWhiteSpace(name))
            {
                Console.WriteLine("Using stdin");
                return;
            }
            var exStdIn = new System.IO.StreamReader($"../../../{name}.txt");
            System.Console.SetIn(exStdIn);
#endif
        }
        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] ReadIntChars()
        {
            // 102 => int[]{1, 0, 2}
            return Console.ReadLine().ToCharArray().Select(c => int.Parse(c.ToString())).ToArray();
        }


        public static int[] ReadIntArray()
        {
            // 12 34 56 => int[]{12, 34, 56}
            return Console.ReadLine().Split().Select(int.Parse).ToArray();
        }

        public static (int a, int b) ReadInt2()
        {
            var ia = ReadIntArray();
            if (ia.Length != 2)
            {
                throw new InvalidCastException();
            }
            return (ia[0], ia[1]);
        }
        public static (int a, int b, int c) ReadInt3()
        {
            var ia = ReadIntArray();
            if (ia.Length != 3)
            {
                throw new InvalidCastException();
            }
            return (ia[0], ia[1], ia[2]);
        }
    }
    public class DefaultDictionary<TKey, TValue> : Dictionary<TKey, TValue> where TValue : new()
    {
        public new TValue this[TKey key]
        {
            get
            {
                if (!TryGetValue(key, out TValue val))
                {
                    val = new TValue();
                    Add(key, val);
                }
                return val;
            }
            set { base[key] = value; }
        }
    }
}

提出情報

提出日時
問題 B - Trimmed Mean
ユーザ bugtori
言語 C# (.NET Core 3.1.201)
得点 200
コード長 2473 Byte
結果 AC
実行時間 95 ms
メモリ 28724 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 2
AC × 23
セット名 テストケース
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 90 ms 28252 KiB
example_01.txt AC 87 ms 28484 KiB
hand_00.txt AC 87 ms 28588 KiB
hand_01.txt AC 79 ms 28176 KiB
hand_02.txt AC 86 ms 28580 KiB
hand_03.txt AC 82 ms 28268 KiB
hand_04.txt AC 95 ms 28724 KiB
hand_05.txt AC 91 ms 28184 KiB
random_00.txt AC 79 ms 28096 KiB
random_01.txt AC 91 ms 28164 KiB
random_02.txt AC 82 ms 28568 KiB
random_03.txt AC 78 ms 28316 KiB
random_04.txt AC 94 ms 28180 KiB
random_05.txt AC 77 ms 28044 KiB
random_06.txt AC 90 ms 28340 KiB
random_07.txt AC 82 ms 28196 KiB
random_08.txt AC 82 ms 28028 KiB
random_09.txt AC 86 ms 27940 KiB
random_10.txt AC 80 ms 28344 KiB
random_11.txt AC 86 ms 28268 KiB
random_12.txt AC 83 ms 28292 KiB
random_13.txt AC 86 ms 28184 KiB
random_14.txt AC 86 ms 28180 KiB