简单的模拟
#include<bits/stdc++.h>
using namespace std;
int n;
int a[100005];
long long cs,cnt,tol,ans=-100005,ansc,css,unt;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
cs=1;css=1;
for(int i=1;i<=n;i++)
{
if(cnt==cs)
{
if(tol>ans)
{
ans=tol;
ansc=css;
}
cs<<=1;
css++;
cnt=0;
tol=0;
}
cnt++;
tol+=a[i];
}
if(tol>ans)
{
ans=tol;
ansc=css;
}
cout<<ansc;
}
0 回复
0 转发
0 喜欢
0 阅读



