Skip to content

Commit ce6d31a

Browse files
authored
Create 466A. Cheap Travel.cpp
1 parent 6d2dbbb commit ce6d31a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

466A. Cheap Travel.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
problem link: https://codeforces.com/contest/466/problem/A
3+
problem name :466A. Cheap Travel;
4+
status:accepted
5+
author: mohand sakr.
6+
7+
*/
8+
9+
#include <iostream>
10+
#include<algorithm>
11+
using namespace std;
12+
13+
int main() {
14+
// your code goes here
15+
16+
int n,m,a,b;
17+
cin>>n>>m>>a>>b;
18+
int answer=0;
19+
20+
if(m*a<=b){
21+
22+
answer=n*a;
23+
24+
}
25+
26+
else
27+
{
28+
answer=(n/m)*b+min((n%m)*a,b);
29+
30+
}
31+
32+
cout<<answer;
33+
return 0;
34+
}

0 commit comments

Comments
 (0)