#include<bits/stdc++.h> using namespace std; const int maxn=100005; long long a[maxn]; int main(){ long long n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } long long m,p1,s1,s2; cin>>m>>p1>>s1>>s2; long long sum1=0; for(long long i=1;i<m;i++){ sum1+=a[i]*(m-i); } long long sum2=0; for(long long i=n;i>m;i--){ sum2+=a[i]*(i-m); } if(p1<m){ sum1+=s1*(m-p1); } else{ sum2+=s1*(p1-m); } long long minDiff=LLONG_MAX; long long minId; for(long long i=1;i<=n;i++){ long long diff; if(i<=m){ diff=abs(sum1+s2*(m-i)-sum2); } else{ diff=abs(sum1-(sum2+s2*(i-m))); } if(diff<minDiff){ minDiff=diff; minId=i; } } cout<<minId; return 0; }
1437 - 龙虎斗(fight)
最新推荐文章于 2024-09-07 16:56:49 发布