Codeforces 466A - Cheap Travel solution
Solution in C++:
///******Bismillahir-Rahmanir-Rahim******///
///AH Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,m,a,b;
- cin>>n>>m>>a>>b;
- if(m*a<=b)
- cout<<n*a<<endl;
- else
- cout<<(n/m)*b+min((n%m)*a,b)<<endl;
- }
No comments