###### 量子流逝

-----------------------------I Will Fight For My Dream

###### SGU 114 Telecasting station 单峰极值函数

2.做被扫描到的人数等于剩下的人数，这种情况的话最佳的位置就是一条线段，这时扫描到的位置实际上是这条线段的左边界，那么右边界就是继续扫描到 第一次被扫描的人数大于未被扫描的人数的那个点，可以证明这个点就是最佳位置的右边界！

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<cstring>
#include<iomanip>
using namespace std;

#ifdef _WIN32
#define i64 __int64
#define out64 "%I64d\n"
#define in64 "%I64d"
#else
#define i64 long long
#define out64 "%lld\n"
#define in64 "%lld"
#endif

#define FOR(i,a,b)      for( int i = (a) ; i <= (b) ; i ++)
#define FF(i,a)         for( int i = 0 ; i < (a) ; i ++)
#define FFD(i,a)        for( int i = (a)-1 ; i >= 0 ; i --)
#define S64(a)          scanf(in64,&a)
#define SS(a)           scanf("%d",&a)
#define LL(a)           ((a)<<1)
#define RR(a)           (((a)<<1)+1)
#define SZ(a)           ((int)a.size())
#define PP(n,m,a)       puts("---");FF(i,n){FF(j,m)cout << a[i][j] << ' ';puts("");}
#define pb              push_back
#define CL(Q)           while(!Q.empty())Q.pop()
#define MM(name,what)   memset(name,what,sizeof(name))
#define write           freopen("out.txt","w",stdout)

const int inf = 0x3f3f3f3f;
const i64 inf64 = 0x3f3f3f3f3f3f3f3fLL;
const double oo = 10e9;
const double eps = 10e-10;
const double pi = acos(-1.0);

struct zz
{
int x;
int p;
bool operator < (const zz & cmp ) const
{
return x < cmp.x;
}
}zx;

int n,sum;
vector<zz>v;

int main()
{
while(cin>>n)
{
v.clear();
sum=0;
for(int i=1;i<=n;i++)
{
SS(zx.x);
SS(zx.p);
sum += zx.p;
v.push_back(zx);
}
sort(v.begin(),v.end());
int ans,temp=0;
int rest = sum;
for(int i=0;i<v.size();i++)
{
temp += v[i].p;
rest -= v[i].p;
if(temp >= rest)
{
cout<<v[i].x;
cout<<".00000"<<endl;
break;
}
}
}
return 0;
}


#### Sgu 114 Telecasting station

2013-04-27 22:52:47

#### SGU 114 Telecasting station

2014-12-16 16:48:13

#### sgu 114 Telecasting station

2012-10-26 10:31:12

#### SGU 114 Telecasting station（水~）

2016-04-14 19:04:11

#### SGU 114 Telecasting station（二分）

2016-08-06 21:48:07

#### 黄金分割法与单峰函数求极值

2016-05-28 11:16:19

#### 【算法设计与数据结构】三分法：求单峰函数的极值

2015-10-21 23:18:12

#### 数学 + 带权中位数 - SGU 114 Telecasting station

2017-03-05 17:24:22

#### 单峰函数

2009-12-31 09:55:00

#### [SGU]114. Telecasting station

2012-10-28 20:53:57

## 不良信息举报

SGU 114 Telecasting station 单峰极值函数