結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2016-03-01 05:17:10 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 261 bytes |
コンパイル時間 | 516 ms |
コンパイル使用メモリ | 58,840 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-24 23:43:40 |
合計ジャッジ時間 | 1,578 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include<iostream>#include<algorithm>using namespace std;#define NMAX 1000int main(){int N;int A[NMAX];cin>>N;for(int i=0;i<N;i++){cin>>A[i];}sort(A,A+N);if(N%2==1) cout<<A[N/2]<<endl;else cout<<(double)(A[N/2]+A[N/2-1])/2<<endl;}