1 solutions

  • 0
    @ 2022-4-8 22:06:39
    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e5+10;
    int n,k,res=0,cnt=0,c=1,ind;
    int main()
    {
    	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    	cin>>n;
    	for(int i=1;i<=n;i++)
    	{
    		cin>>k;
    		cnt+=k;
    		if(i==1){
    			res=k;
    			ind=c++;
    			continue;
    		}
    		if(pow(2,c)==i-1)
    		{
    			if(cnt>res)
    			{
    				res=cnt;
    				ind=c;
    			}
    			cnt=0;
    			c++;
    		}
    	}
    	cout<<ind;
    	return 0;
    }
    

    Information

    ID
    6470
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    7
    Tags
    # Submissions
    94
    Accepted
    24
    Uploaded By