結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2019-06-28 16:06:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 236 bytes |
コンパイル時間 | 1,888 ms |
コンパイル使用メモリ | 196,688 KB |
最終ジャッジ日時 | 2025-01-07 05:18:36 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
·#include <bits/stdc++.h>int main() {int N;std::cin >> N;std::vector<int> A(N);for(auto&v:A)std::cin >> v;std::sort(begin(A),end(A));auto ans = (N%2)?A[N/2]:((A[N/2-1]+A[N/2])/2.0);std::cout << ans << std::endl;}