結果
| 問題 |
No.275 中央値を求めよ
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2017-02-10 22:11:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 248 bytes |
| コンパイル時間 | 1,647 ms |
| コンパイル使用メモリ | 159,956 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-28 03:38:39 |
| 合計ジャッジ時間 | 3,216 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 20 WA * 18 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int n;
cin>>n;
double a[n];
for(int i=0;i<n;i++) cin>>a[i];
sort(a,a+n);
if(n%2) cout<<a[n/2]<<endl;
else cout<<(a[n/2]+a[n/2+1])/2.0<<endl;
return 0;
}
beet