We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d2dbbb commit ce6d31aCopy full SHA for ce6d31a
466A. Cheap Travel.cpp
@@ -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