結果
| 問題 |
No.275 中央値を求めよ
|
| ユーザー |
keisuke6
|
| 提出日時 | 2022-10-15 18:22:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 1,000 ms |
| コード長 | 273 bytes |
| コンパイル時間 | 1,912 ms |
| コンパイル使用メモリ | 197,980 KB |
| 最終ジャッジ日時 | 2025-02-08 06:49:04 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int N;
cin>>N;
vector<int> S(N);
for(int i=0;i<N;i++) cin>>S[i];
sort(S.begin(),S.end());
if(N%2) cout<<S[N/2]<<endl;
else cout<<(S[N/2]+S[N/2-1]*1.0)/2<<endl;
}
keisuke6