結果
| 問題 |
No.275 中央値を求めよ
|
| コンテスト | |
| ユーザー |
conf
|
| 提出日時 | 2016-09-25 15:39:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 430 bytes |
| コンパイル時間 | 607 ms |
| コンパイル使用メモリ | 70,056 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-25 00:02:18 |
| 合計ジャッジ時間 | 1,662 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main(){
int N;
cin>>N;
vector<int> V;
for(int i=0;i<N;i++){
int a;
cin>>a;
V.push_back(a);
}
sort(V.begin(),V.end());
if(N%2){
cout<<V[N/2]<<endl;
}else{
cout<<fixed;
cout.precision(1);
cout<<(V[N/2]+V[N/2-1])/2.0<<endl;
}
return 0;
}
conf