POJ 2388:Who's in the Middle】的更多相关文章

Who's in the Middle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 31015   Accepted: 17991 Description FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give…
/** \brief poj 2388 insert sorting 2015 6 12 * * \param * \param * \return * */ #include <iostream> #include <cstdio> #include <cstring> using namespace std; const int N=10000; int Arr[N]; void insertSort(int len) { for(int j=1;j<len;…
http://poj.org/problem?id=3321 http://acm.hdu.edu.cn/showproblem.php?pid=3887 POJ 3321: 题意:给出一棵根节点为1的边不一定的树,然后给出问题:询问区间和 或者 节点值更新. HDU 3887: 题意:和POJ 3321的题意差不多,只不过对每个节点询问不包含该节点的区间和 思路:今天才学了下才知道有DFS序这种东西,加上树状数组处理一下区间和 和 节点更新. DFS序大概就是我们在DFS遍历一棵树的时候,在进…
POJ 3252:Round Numbers Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10099 Accepted: 3669 Description The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Sciss…
Ultra-QuickSort Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 48111   Accepted: 17549 Description In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swappin…
id=2965">The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 18080   Accepted: 6855   Special Judge Description The game "The Pilots Brothers: following the stripy elephant" has a quest where a…
[题意]求数列中间项. ---这里可以扩展到数列第K项. 第一次做的时候直接排序水过了= =--这一次回头来学O(N)的快速选择算法. 快速选择算法基于快速排序的过程,每个阶段我们选择一个数为基准,并把区间划分成小于这个数和大于这个数的两个子区间,此时便可以判断这个数是不是第k大项,如果比K大,则去左区间找,否则去右区间找. #include #include #include #include #include using namespace std; template doubleORint…
Who's in the Middle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 31149   Accepted: 18073 Description FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give…
题目链接:http://poj.org/problem?id=2388 题目大意: 奇数个数排序求中位数 解题思路:看代码吧! AC Code: #include<stdio.h> #include<algorithm> using namespace std; int main() { int n; while(scanf("%d",&n)!=EOF) { ]; ; i<n; i++) scanf("%d",&na[i…
http://poj.org/problem?id=2388 题意:就N个数的中位数. 思路:用快排就行了.但我没用快排,我自己写了一个堆来做这个题.主要还是因为堆不怎么会,这个拿来练练手. #include <stdio.h> #include <string.h> ],ans,n; void inset(int x,int y) //插入,并排序. { int i; ] > x;i /= ) arr[ i ] = arr[ i / ]; arr[ i ] = x; } {…