- 问答
龙虎斗这两个错哪了?
- 2023-11-25 22:58:49 @
#include<bits/stdc++.h>
using namespace std;
long long a[999999],qishi[999999];
int main()
{
long long n,m,p1,s1,s2;
long long dragon=0,tiger=0;
cin >> n;
for(long long i=1;i<=n;i++)
cin >> a[i];
cin >> m >> p1 >> s1 >> s2;
a[p1]+=s1;
for(long long i=1;i<=n;i++)
qishi[i]=a[i]*abs(i-m);
for(long long i=1;i<m;i++)
dragon+=qishi[i];
for(long long i=n;i>m;i--)
tiger+=qishi[i];
long long c=abs(dragon-tiger),maxn=m;
if(dragon>tiger)
{
for(long long i=m+1;i<=n;i++)
{
if(c>abs(tiger+((i-m)*s2)-dragon))
{
c=abs(tiger+((i-m)*s2)-dragon);
maxn=i;
}
}
cout << maxn << endl;
}
if(dragon<tiger)
{
for(long long i=1;i<m;i++)
{
if(c>abs(dragon+((m-i)*s2)-tiger))
{
c=abs(dragon+((m-i)*s2)-tiger);
maxn=i;
}
}
cout << maxn << endl;
}
return 0;
}
3 comments
-
zhangyurui SVIP LV 9 @ 2023-11-25 23:33:57
ok了OK了,没考虑实力势相等的情况下咋输出
-
2023-11-25 22:59:52@
-
2023-11-25 22:59:39@
总有8分得不上
- 1