結果

問題 No.275 中央値を求めよ
ユーザー phantomShin
提出日時 2019-11-07 20:57:48
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 346 bytes
コンパイル時間 1,387 ms
コンパイル使用メモリ 162,080 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-15 00:44:35
合計ジャッジ時間 2,813 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 23 WA * 14 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;


int main(){
   int N; cin >> N;
   vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A.at(i);
    sort(A.begin(), A.end());
    if(N%2==0) cout << (double)(A.at(N/2-1) + A.at(N/2))/2 << endl;
    else cout << (double)A.at(N/2-1) << endl;
}



             
            
    
0