結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2015-09-04 22:22:15 |
言語 | C++11 (gcc 4.8.5) |
結果 |
AC
|
実行時間 | 4 ms |
コード長 | 498 Byte |
コンパイル時間 | 559 ms |
使用メモリ | 8,920 KB |
最終ジャッジ日時 | 2019-02-07 15:20:22 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
99_system_test1.txt | AC | 3 ms
6,872 KB |
99_system_test2.txt | AC | 3 ms
6,868 KB |
99_system_test3.txt | AC | 2 ms
6,872 KB |
sample1.txt | AC | 4 ms
6,872 KB |
sample2.txt | AC | 3 ms
6,872 KB |
sample3.txt | AC | 4 ms
6,872 KB |
system_test1.txt | AC | 4 ms
6,872 KB |
system_test2.txt | AC | 4 ms
8,920 KB |
system_test3.txt | AC | 4 ms
6,872 KB |
system_test4.txt | AC | 3 ms
6,868 KB |
system_test5.txt | AC | 2 ms
6,872 KB |
test1.txt | AC | 3 ms
6,868 KB |
test2.txt | AC | 2 ms
6,872 KB |
test3.txt | AC | 4 ms
6,872 KB |
test4.txt | AC | 3 ms
6,872 KB |
test5.txt | AC | 4 ms
6,868 KB |
test6.txt | AC | 3 ms
6,872 KB |
test7.txt | AC | 3 ms
6,872 KB |
test8.txt | AC | 2 ms
8,920 KB |
test9.txt | AC | 3 ms
6,872 KB |
test10.txt | AC | 3 ms
6,868 KB |
test11.txt | AC | 4 ms
6,872 KB |
test12.txt | AC | 4 ms
6,868 KB |
test13.txt | AC | 3 ms
8,916 KB |
test14.txt | AC | 4 ms
6,872 KB |
test15.txt | AC | 3 ms
6,872 KB |
test16.txt | AC | 2 ms
6,872 KB |
test17.txt | AC | 3 ms
6,872 KB |
test18.txt | AC | 4 ms
8,916 KB |
test19.txt | AC | 4 ms
6,868 KB |
test20.txt | AC | 4 ms
8,916 KB |
test21.txt | AC | 4 ms
6,872 KB |
test22.txt | AC | 4 ms
6,872 KB |
test23.txt | AC | 4 ms
6,872 KB |
test24.txt | AC | 3 ms
6,868 KB |
test25.txt | AC | 3 ms
6,868 KB |
test26.txt | AC | 3 ms
6,868 KB |
test27.txt | AC | 4 ms
6,868 KB |
test28.txt | AC | 4 ms
6,868 KB |
test29.txt | AC | 4 ms
6,868 KB |
test30.txt | AC | 4 ms
6,872 KB |
ソースコード
#include <iostream> #include <string> #include <vector> #include <cmath> #include <algorithm> #include <cstdlib> #include <ctime> #include <cstdio> #include <functional> #include <set> #include <sstream> #include <map> #include <queue> #include <stack> using namespace std; int main() { int n; cin>>n; vector<int> v(n); for(int i=0;i<n;i++) cin>>v[i]; sort(v.begin(),v.end()); if(n%2) cout<<v[n/2]<<endl; else cout<<(v[n/2-1]+v[n/2])/2.0<<endl; return 0; }