結果
| 問題 |
No.275 中央値を求めよ
|
| ユーザー |
phantomShin
|
| 提出日時 | 2019-11-07 21:05:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 336 bytes |
| コンパイル時間 | 1,435 ms |
| コンパイル使用メモリ | 162,376 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-15 00:44:38 |
| 合計ジャッジ時間 | 2,612 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#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 << A.at(N/2) << endl;
}
phantomShin