HDOJ 1157 Who's in the Middle(水)
2015-02-28 23:26
323 查看
【思路】:求中位数。这么水的题都写是不是显得我很low...其实我只是有强迫症而已。。
【AC代码】:
【AC代码】:
#include <iostream> #include <cstdlib> #include <cstdio> #include <cstring> #include <cmath> #include <iomanip> #include <algorithm> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ #define MAX 10000+10 int main(int argc, char** argv) { //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); int n = 0; while (cin >> n) { int i = 0; int milk[MAX]; for (i = 0; i < n; i++) cin >> milk[i]; sort(milk, milk+n); cout << milk[n/2] << endl;; } return 0; }
相关文章推荐
- [HDOJ 1157] Who's in the Middle (基础题)
- POJ 2388 && HDU 1157 Who's in the Middle(水~)
- HDU 1157 Who's in the Middle
- HDU 1157 Who's in the Middle(排序取中间值)
- HDU 1157 Who's in the Middle
- 杭电OJ——1157 Who's in the Middle(水题)
- hdu 1157 Who's in the Middle
- HDU 1157 Who's in the Middle
- HDU 1157 Who's in the Middle
- HDU—— 1157 Who's in the Middle
- HDU 1157 Who's in the Middle
- hdu 1157 (1.3.7) Who's in the Middle
- 杭电 HDU 1157 Who's in the Middle
- HDU 1157 Who's in the Middle
- hdu 1157 Who's in the Middle
- HDU 1157 Who's in the Middle【水题】
- 杭电1157 Who's in the Middle
- HDU 1157 Who's in the Middle (快速排序 or 任意排序)
- HDU 1157 POJ 2388 Who's in the Middle 求中位数
- 杭电1157(Who's in the Middle)