Question 6

5 comments on “Question 6”


  • Prajwal

    #include

    using namespace std;

    int main()
    {
    int T;
    cin>>T;
    while(T–){

    int b, w, bc, wc, z, ans=0;
    cin>>b>>w>>bc>>wc>>z;

    if(bc<wc and bc+zwc and wc+z<bc){
    ans=(b+w)*wc+z*b;
    }else{
    ans=bc*b+wc*w;
    }

    cout<<ans<<endl;
    }
    return 0;
    }


  • culbgaming12

    #include

    using namespace std;

    int min(int a, int b, int c)
    {
    if (a > t;
    for (int i = 1; i > b >> w;
    cin >> bc >> wc >> z;

    int org_cost = b * bc + wc * w;

    if (bc < wc)
    {
    wc = bc + z;
    }

    else
    {
    bc = wc + z;
    }

    int calculated_cost = b * bc + w * wc;

    cout << min(org_cost, calculated_cost) << endl;
    }
    return 0;
    }


  • PrimeVideo

    Team, could you please let me know why only python language code is present? We have bought prepinsta prime video for 2000 and if our preferred language code is not present its really difficult for us to analyse other language codes


  • Gangadhar

    import java.util.Scanner;

    public class Solution {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    System.out.println(“enter no of test cases:”);
    int t = sc.nextInt();
    System.out.println(“Enter number of black and white gifts and their price”);
    int[] minPrice=new int[t];
    for (int i = 0; i < t; i++) {

    int bg = sc.nextInt();
    int wg = sc.nextInt();
    int bgp = sc.nextInt();
    int wgp = sc.nextInt();
    int gcp = sc.nextInt();

    minPrice[i]= Math.min(bg*bgp+wg*wgp, Math.min(bg*bgp+wg*bgp+wg*gcp, bg*wgp+wg*wgp+bg*gcp));

    }
    for (int i : minPrice) {
    System.out.println(i);
    }

    }

    }


  • Aman

    #include
    using namespace std;

    int main() {
    int T;
    cin>>T;
    while(T>0)
    {
    int b,w,bc,wc,z;
    cin>>b>>w;
    cin>>bc>>wc>>z;
    int oc=b*bc+w*wc;
    if(bc<wc)
    {
    wc=bc+z;
    }
    else
    bc=wc+z;
    int cc= b*bc+w*wc;
    if(oc<cc)
    cout<<oc<<endl;
    else
    cout<<cc<<endl;
    T–;

    }
    return 0;
    }