是贪心吧,样例通过代码:
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100001
long long t, n, c, d, last;
long long a[MAXN];
long long ans, cnt;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> t;
while (t--){
cin >> n >> c >> d;
for (int i=1; i<=n; i++) cin >> a[i];
sort(a+1, a+n+1);
ans = c*n+d;
cnt = (a[1]-1)*d;
last = a[1];
for (int i=2; i<=n; i++){
if ((a[i]-last-1)*d >= c || a[i] == last){
cnt += c;
}else{
cnt += (a[i]-last-1)*d;
last = a[i];
}
}
cout << min(ans, cnt) << '\n';
}
return 0;
}
但是WA了……