YOJ208 严神的机器人 III
二分初始体力模拟即可
#include<bits/stdc++.h>
using namespace std;
int n,h[110000];
inline bool check(int mid){
long long md=mid;
for (int i=1;i<n;++i){
md*=2; if (md>1e10) md=1e10;
md-=h[i+1];if (md<=0) return 0;
}return 1;
}
int main(){
//freopen("c.in","r",stdin);
scanf("%d",&n);
for (int i=1;i<=n;++i) scanf("%d",&h[i]);
int l=1,r=1e9+1,ans;
while(l<=r){
int mid=l+r>>1;
if (check(mid)) ans=mid,r=mid-1;else l=mid+1;
}
printf("%d\n",ans);
return 0;
}