原题地址 p1位置加s1个工兵,先算一遍双方势力之差,然后依次枚举把s2个工兵放在所有的兵营里,取最小就行了 #include<iostream> #include<cmath> #include<cstdio> using namespace std; long long n,m,sum1,sum2,minn,mink,a[100010],p,s1,s2; int read(){ int x=0; int mk=1; char ch=getchar(); while(ch!='-'&&(ch<'0'||ch>'9')) ...