Taum and B'day | Hackerrrank solution in C++
Taum and B'day | Hackerrrank solution
It is an hackerrank problem you can find it by clicking here.
Below given solution is prepared by one of the coder of our.
C++ SOLUTION
#include<bits/stdc++.h>
using namespace std;
int main()
{
long int n;
cin>>n;
for(long int i=0;i<n;i++)
{
long int b,w,bc,wc,z;
cin>>b>>w;
cin>>bc>>wc>>z;
long long int min;
min = b*bc + w*wc;
if((b*bc + w*(bc+z))<min)
min= b*bc+w*(bc+z);
else if((b*(wc+z)+w*wc)<min)
min = b*(wc+z) + w*wc;
cout<<min<<endl;
}
return 0;
}

Comments
Post a Comment