結果
問題 |
No.275 中央値を求めよ
|
ユーザー |
|
提出日時 | 2018-03-08 15:11:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 387 bytes |
コンパイル時間 | 1,332 ms |
コンパイル使用メモリ | 168,824 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-05 07:51:53 |
合計ジャッジ時間 | 2,314 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 WA * 4 |
ソースコード
#include <bits/stdc++.h> using namespace std; namespace { int A[ 1010 ]; } int main() { int i; int N; int x; cin >> N; for( i = 0; i < N; i++ ) cin >> A[ i ]; sort( A, A + N ); if( N % 2 == 1 ) cout << A[ N / 2 ] << endl; else { i = N / 2; x = A[ i - 1 ] + A[ i ]; if( x % 2 == 1 ) cout << x / 2 << ".5" << endl; else cout << x / 2 << endl; } return 0; }