Created
December 18, 2012 00:09
-
-
Save diego9627/4323641 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<fstream> | |
#include<algorithm> | |
using namespace std; | |
ifstream fin("wifi.in"); | |
ofstream fout("wifi.out"); | |
int main(){ | |
long long int N,A,B,cows[1001],cost=0; | |
fin >> N >> A >> B; | |
for(int i=0;i<N;i++) fin >> cows[i]; | |
sort(cows,cows+N); | |
cost=2*A; | |
for(int i=1;i<N;i++){ | |
cost+=min(2*A,(cows[i]-cows[i-1])*B); | |
} | |
fout << (cost/2); | |
if(cost%2) fout << '.' << 5 << '\n'; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment