結果
| 問題 |
No.275 中央値を求めよ
|
| ユーザー |
Konton7
|
| 提出日時 | 2020-01-15 15:01:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 315 bytes |
| コンパイル時間 | 1,861 ms |
| コンパイル使用メモリ | 194,824 KB |
| 最終ジャッジ日時 | 2025-01-08 18:08:25 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 20 WA * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a, a+n);
if (n % 2)
cout << a[n/2];
else
cout << 0.5*(a[n/2]+a[n/2+1]);
cout << endl;
return 0;
}
Konton7