HDU6383 p1m2
二分
#include
using namespace std;
const int MAX=3e5+5;
const int INF=0x3f3f3f3f;
int t,n,a[MAX];
bool check(long long x)
{
long long cnt1=0,cnt2=0;
int sub;
for(int i=0;i0) cnt1+=sub/2;
else cnt2+=-sub;
}
return cnt1>=cnt2;
}
int main()
{
int min_,max_;
scanf("%d",&t);
while(t--)
{
min_=INF;max_=-INF;
scanf("%d",&n);
for(int i=0;i>1;
if(check(mid)) l=mid+1,ans=mid;
else r=mid-1;
}
printf("%d\n",ans);
}
return 0;
}