結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2018-09-04 17:31:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 296 bytes |
コンパイル時間 | 1,277 ms |
コンパイル使用メモリ | 160,940 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 01:56:52 |
合計ジャッジ時間 | 2,409 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include<bits/stdc++.h> #define REP(i,n) for(int i=0;i<(int)(n);i++) using namespace std; typedef long long int ll; int main() { int N,A[1001]; cin >> N; REP(i,N)cin >> A[i]; sort(A,A+N); if(N%2)cout << A[N/2] << endl; else cout << (1.*A[N/2-1]+A[N/2])/2.0 << endl; return 0; }