結果
問題 | No.275 中央値を求めよ |
ユーザー |
|
提出日時 | 2020-03-12 00:55:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 351 bytes |
コンパイル時間 | 1,664 ms |
コンパイル使用メモリ | 172,504 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-16 04:29:48 |
合計ジャッジ時間 | 2,907 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include <bits/stdc++.h>#define rep(i, n) for (int i = 0; i < n; ++i)using ll = long long;using namespace std;const int INF = 1e9;int main() {int N;cin >> N;vector<double> A(N);rep(i, N) cin >> A[i];sort(A.begin(), A.end());double ans = (A[(N - 1) / 2] + A[N / 2]) / 2;printf("%.1f\n", ans);return 0;}