#include<stdio.h>
int main(){
unsigned long long int t,n,a,b,i,c=1,j,sum,ar,x;
scanf("%llu",&t);
while(t--){
scanf("%llu %llu %llu",&n,&a,&b);
sum=(n*b+2*a);
scanf("%llu",&ar);
x=ar;
for(i=1;i<n;i++){
scanf("%llu",&ar);
j=(ar-x-1)*b;
if(j<=2*a)
sum+=j;
else
sum+=(2*a);
x=ar;
}
printf("Case #%llu: %llu\n",c,sum);
c++;
}
return 0;
}
int main(){
unsigned long long int t,n,a,b,i,c=1,j,sum,ar,x;
scanf("%llu",&t);
while(t--){
scanf("%llu %llu %llu",&n,&a,&b);
sum=(n*b+2*a);
scanf("%llu",&ar);
x=ar;
for(i=1;i<n;i++){
scanf("%llu",&ar);
j=(ar-x-1)*b;
if(j<=2*a)
sum+=j;
else
sum+=(2*a);
x=ar;
}
printf("Case #%llu: %llu\n",c,sum);
c++;
}
return 0;
}
No comments:
Post a Comment