#include<bits/stdc++.h>
using namespace std;
int c[100010];
int dragon,tiger;
int main()
{
int n;//兵营数
cin >> n;
for(int i = 1;i <= n;i++)
cin >> c[i];

int m,p1,s1,s2,q;//特殊,神兵营1,神兵数1,神兵数2,记录神兵数
cin >> m >> p1 >> s1 >> s2;

for(int i = 1;i < m;i++)
{
dragon += c[i] * ( m - i);
}//计算龙方实力

for(int i = n;i > m;i--)
{
tiger += c[i] * (i - m);
}//虎方实力

if(p1 > m)
tiger += s1 * (p1 - m);
else if(p1 < m)
dragon += s1 * (m - p1);
//神兵1	
int jueduizhi = abs(tiger - dragon);//实力差
if(dragon > tiger)
{
int k = jueduizhi;//记录原实力差
int minn = 0;//最小实力差
for(int i = n;i > m;i--)
{
int p = tiger;
tiger += s2 * (i - m);
jueduizhi = abs(tiger - dragon);
if(jueduizhi < minn)
{
minn = jueduizhi;
q = i;
}
tiger = p;
jueduizhi =  k;
}
}
else
{
int k = jueduizhi;
int minn = 0;
for(int i = 1;i < m;i++)
{
int p = dragon;
dragon += s2 * (m - i);
jueduizhi = abs(tiger - dragon);
if(jueduizhi < minn)
{
minn = jueduizhi;
q = i;
}
dragon = p;
jueduizhi = k;
}
}

//	cout << dragon << ' ' << tiger << endl;
cout << q;
return 0;
}



3 comments

  • 1