結果
| 問題 |
No.275 中央値を求めよ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-10-04 14:12:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 666 bytes |
| コンパイル時間 | 706 ms |
| コンパイル使用メモリ | 68,908 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-24 23:20:56 |
| 合計ジャッジ時間 | 1,956 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <cstdio>
using namespace std;
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/* */
/* 入力開始! */
/* 入力終了! */
int main(void)
{
int i,j,k,l;
int n;
int e[1000];
double d;
cin >> n;
rep(i,n) cin >> e[i];
sort(e,e+n);
if(n % 2) cout << e[n/2] << endl;
else {
d = ((double)e[n/2]+e[n/2-1])/2;
cout << d << endl;;
}
return 0;
}