zoukankan      html  css  js  c++  java
  • Codeforces Round #608 (Div. 2) A. Suits

    链接:

    https://codeforces.com/contest/1271/problem/A

    题意:

    A new delivery of clothing has arrived today to the clothing store. This delivery consists of a ties, b scarves, c vests and d jackets.

    The store does not sell single clothing items — instead, it sells suits of two types:

    a suit of the first type consists of one tie and one jacket;
    a suit of the second type consists of one scarf, one vest and one jacket.
    Each suit of the first type costs e coins, and each suit of the second type costs f coins.

    Calculate the maximum possible cost of a set of suits that can be composed from the delivered clothing items. Note that one item cannot be used in more than one suit (though some items may be left unused).

    思路:

    判断优先级

    代码:

    #include<bits/stdc++.h>
    using namespace std;
    
    int main()
    {
        int a, b, c, d, e, f;
        scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
        if (e > f)
        {
            int ans = e*min(a, d);
            d -= min(a, d);
            ans += f*min(b, min(c, d));
            printf("%d
    ", ans);
        }
        else
        {
            int ans = f*min(b, min(c, d));
            d -= min(b, min(c, d));
            ans += e*min(a, d);
            printf("%d
    ", ans);
        }
    
        return 0;
    }
    
  • 相关阅读:
    Lake Counting
    部分和问题
    迷宫最短路
    sublime 的使用技巧
    数组
    Factorial Trailing Zeroes
    Top K Frequent Elements
    Number of Connected Component in An Undirected Graph
    Zigzag Iterator
    Single Number III
  • 原文地址:https://www.cnblogs.com/YDDDD/p/12089052.html
Copyright © 2011-2022 走看看