結果

問題 No.275 中央値を求めよ
ユーザー 0htoAi
提出日時 2021-12-03 20:23:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 363 bytes
コンパイル時間 1,670 ms
コンパイル使用メモリ 169,020 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-06 03:53:03
合計ジャッジ時間 3,190 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 28 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

const int MAXN=1e4+50;

int N,a[MAXN];

int main()
{
	scanf("%d",&N);
	for(int i=1;i<=N;i++)
	scanf("%d",&a[i]);
	sort(a+1,a+N+1);
	if(N&1)
	printf("%d",a[N/2+1]);
	else
	{
		if(a[N/2]+a[N/2+1]&1)
		printf("%.1lf %.1lf",(a[N/2]+a[N/2+1])*0.50,(a[N/2]+a[N/2+1])*0.50);
		else
		printf("%d",(a[N/2]+a[N/2+1])/2);
	}
}
0