結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2020-11-06 15:34:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 531 bytes |
コンパイル時間 | 1,784 ms |
コンパイル使用メモリ | 196,972 KB |
最終ジャッジ日時 | 2025-01-15 20:03:48 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include <bits/stdc++.h>typedef long long ll;using namespace std;const int INF = 1e9;const int MOD = 1e9+7;const ll LINF = 1e18;using pii = pair<int,int>;#define FOR(i,a,b) for(int i=(a);i<(b);++i)#define REP(i,n) for(int i=0;i<(n);++i)#define COUT(x) cout<<(x)<<"\n"#define COUT15(x) cout << fixed << setprecision(15) << (x) << "\n";int main(){int n;cin >> n;vector<int> a(n);REP(i,n) cin >> a[i];sort(a.begin(),a.end());if(n%2!=0)COUT(a[n/2]);else COUT((a[n/2-1]+a[n/2])/2.0);}