結果
| 問題 |
No.275 中央値を求めよ
|
| ユーザー |
|
| 提出日時 | 2020-03-31 21:08:51 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 601 bytes |
| コンパイル時間 | 869 ms |
| コンパイル使用メモリ | 132,452 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-30 17:15:58 |
| 合計ジャッジ時間 | 1,904 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
using ldouble = long double;
void solve() {
int n;
std::cin >> n;
std::vector<int> xs(n * 2);
for (int i = 0; i < n; ++i) {
std::cin >> xs[i * 2];
xs[i * 2 + 1] = xs[i * 2];
}
std::sort(xs.begin(), xs.end());
int s = xs[n - 1] + xs[n];
std::cout << std::fixed << std::setprecision(1)
<< ldouble(s) / 2 << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::cout.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}