結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2017-08-10 09:35:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 434 bytes |
コンパイル時間 | 1,408 ms |
コンパイル使用メモリ | 160,972 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 00:36:46 |
合計ジャッジ時間 | 2,462 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include <bits/stdc++.h> #define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) #define MOD 1000000007 #define int long long using namespace std; typedef long long ll; const int INF = 1e9; int N; int A[1010]; signed main() { cin >> N; REP(i,N) cin >> A[i]; sort(A, A + N); if (N % 2 == 0) { cout << (A[N/2] + A[N/2-1]) / 2.0 << endl; } else { cout << A[N/2] << endl; } }