Codeforces 1342A - Road To Zero Solution
Solution in C++:
///La ilaha illellahu muhammadur rasulullah
///******Bismillahir-Rahmanir-Rahim******///
///AH Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long int a,b,mn,d,x,y,t,m,n;
- cin>>t;
- while(t--)
- {
- cin>>x>>y>>a>>b;
- m= min(x,y)*b+abs(x-y)*a;
- n=(x+y)*a;
- cout<<min(m,n)<<endl;
- }
- }
No comments