結果

問題 No.275 中央値を求めよ
ユーザー #ラス+#ラス+
提出日時 2019-11-07 15:01:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 75 ms / 1,000 ms
コード長 1,388 bytes
コンパイル時間 834 ms
コンパイル使用メモリ 61,908 KB
実行使用メモリ 26,828 KB
最終ジャッジ日時 2023-10-13 03:00:41
合計ジャッジ時間 5,092 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
22,592 KB
testcase_01 AC 66 ms
22,608 KB
testcase_02 AC 66 ms
22,668 KB
testcase_03 AC 59 ms
20,780 KB
testcase_04 AC 66 ms
24,684 KB
testcase_05 AC 65 ms
24,556 KB
testcase_06 AC 67 ms
24,716 KB
testcase_07 AC 74 ms
22,740 KB
testcase_08 AC 67 ms
20,948 KB
testcase_09 AC 67 ms
20,940 KB
testcase_10 AC 73 ms
22,920 KB
testcase_11 AC 57 ms
18,564 KB
testcase_12 AC 62 ms
20,648 KB
testcase_13 AC 59 ms
20,644 KB
testcase_14 AC 62 ms
20,772 KB
testcase_15 AC 74 ms
23,032 KB
testcase_16 AC 74 ms
24,936 KB
testcase_17 AC 74 ms
23,004 KB
testcase_18 AC 74 ms
22,908 KB
testcase_19 AC 68 ms
20,908 KB
testcase_20 AC 75 ms
24,944 KB
testcase_21 AC 74 ms
22,896 KB
testcase_22 AC 74 ms
22,872 KB
testcase_23 AC 67 ms
20,884 KB
testcase_24 AC 74 ms
26,828 KB
testcase_25 AC 74 ms
24,976 KB
testcase_26 AC 69 ms
20,852 KB
testcase_27 AC 68 ms
20,944 KB
testcase_28 AC 62 ms
22,704 KB
testcase_29 AC 67 ms
20,808 KB
testcase_30 AC 61 ms
22,896 KB
testcase_31 AC 74 ms
25,008 KB
testcase_32 AC 66 ms
20,792 KB
testcase_33 AC 67 ms
20,976 KB
testcase_34 AC 60 ms
22,780 KB
testcase_35 AC 66 ms
21,028 KB
testcase_36 AC 67 ms
20,892 KB
testcase_37 AC 74 ms
22,752 KB
testcase_38 AC 72 ms
24,848 KB
testcase_39 AC 68 ms
22,952 KB
testcase_40 AC 68 ms
21,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.IO;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
class Start{
  static void Solve(){
    var n=Rint();
    var a=new List<int>();
    for(int i=0;i<n;i++)a.Add(Rint());
    a.Sort();
    if(n%2==1)Write(a[n/2]+LF);
    else{Wdoub((a[n/2-1]+a[n/2])/2.0,1);Write(LF);}
  }
  static void Main(){
    readcount=-1;
    read=In.ReadToEnd().Split(' ','\n');
    var sw=new StreamWriter(OpenStandardOutput()){AutoFlush=false};
    SetOut(sw);
    Solve();
    Out.Flush();
  }
  static string Read(){readcount++;return read[readcount];}
  static int Rint(){readcount++;return int.Parse(read[readcount]);}
  static long Rlon(){readcount++;return long.Parse(read[readcount]);}
  static double Rdou(){readcount++;return double.Parse(read[readcount]);}
  static char Rcha(){readcount++;return read[readcount][0];}
  static void Wdoub(double d,int i){Write(d.ToString("F"+i));}
  static string[] read;static int readcount;
  const long MOD=1000000007L;
  const string LF="\n";
  static void Swap<T>(ref T a,ref T b){T c=a;a=b;b=c;}
}
class Pair<T1,T2>:IComparable<Pair<T1,T2>>where T1:IComparable<T1>where T2:IComparable<T2>{
  public T1 F;public T2 S;
  public Pair(T1 f,T2 s){F=f;S=s;}
  public int CompareTo(Pair<T1,T2> p)=>F.CompareTo(p.F)!=0?F.CompareTo(p.F):S.CompareTo(p.S);
  public override string ToString()=>F+" "+S;
}
0