結果
問題 |
No.275 中央値を求めよ
|
ユーザー |
![]() |
提出日時 | 2017-09-23 18:31:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 567 bytes |
コンパイル時間 | 784 ms |
コンパイル使用メモリ | 79,220 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-14 04:15:46 |
合計ジャッジ時間 | 1,727 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 14 |
ソースコード
#include<iostream> #include<string> #include<string.h> #include<algorithm> #include<stdio.h> #include<cmath> #include<vector> #include<utility> #include<queue> #include<stack> #include<stdlib.h> #define FOR(i, a, b) for(int i=(a);i<=(b);i++) #define RFOR(i, a, b) for(int i=(a);i>=(b);i--) #define MOD 1000000007 using namespace std; int main(void) { int n; double a[1001]; cin >> n; FOR(i, 1, n) { cin >> a[i]; } sort(a, a + n + 1); if (n % 2 == 1) { printf("%.1lf\n", a[n / 2 + 1]); } else { printf("%.1lf\n", (a[n/2]+a[n/2+1])/2); } return 0; }