結果
問題 |
No.275 中央値を求めよ
|
ユーザー |
|
提出日時 | 2017-12-05 13:20:19 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 465 bytes |
コンパイル時間 | 435 ms |
コンパイル使用メモリ | 55,336 KB |
実行使用メモリ | 12,192 KB |
最終ジャッジ日時 | 2024-11-28 16:33:54 |
合計ジャッジ時間 | 12,178 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | AC * 1 WA * 16 RE * 21 |
ソースコード
#include <iostream> #include <string> int main() { int N; float A[1000]; int B[1000]; std::cin >> N; for (int i=0; i<N; i++) { std::cin >> A[i]; } for (int i=0; i<N; i++) { for (int j=0; j<N; j++) { if (A[i] > A[j]) B[i] += 1; } } if (N % 2 == 0) std::cout << ((A[B[N/2]] + A[B[N/2-1]]) / 2) << std::endl; else std::cout << A[B[N/2-1]] << std::endl; return 0; }