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;
}
Hope your doubt regarding this problem is clear.

This solution is POWERED By : Coding Winds

            

Comments

Popular posts from this blog

Apple and Orange | Hackerrank Solution in C++

Maximum Draws | Hackerrank Solution in C++

Minimum Distances | Hackerrank Solutions in C++