因为只能买一次,暴力枚举一下买的衣服的大小。

#include<cstdio>
#include<map>
#include<algorithm> using namespace std;
typedef long long ll;
#define fi first
#define se second
const int maxn = 1e5+;
map<int,int> S; int main()
{
int T;
scanf("%d",&T);
for(int k = ; k <= T; k++){
int N,D,C;
scanf("%d%d%d",&N,&D,&C); printf("Case %d: ",k);
if(D<=C) {
int nn = N;
while(nn--) { int t; scanf("%d",&t); }
printf("%lld\n",(ll)D*N);
continue;
}
S.clear();
for(int i = ; i < N; i++){
int t;
scanf("%d",&t);
S[t]++;
}
int sum = ;
ll min_cos = (ll)D*N;
for(map<int,int>::iterator it = S.begin(); it != S.end(); it++) {
sum += it->se;
min_cos = min(((ll)C*it->fi-D)*sum+(ll)D*N,min_cos);
}
printf("%lld\n",min_cos);
}
return ;
}

code Gym 100500D T-shirts(暴力)的更多相关文章

  1. Codeforces gym 100685 A. Ariel 暴力

    A. ArielTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/A Desc ...

  2. Codeforces Gym 100637G G. #TheDress 暴力

    G. #TheDress Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/G ...

  3. Gym 101055A 计算几何,暴力

    http://codeforces.com/gym/101055/problem/A 题目:给定一些三维空间的点,要你找一个平面,能覆盖尽量多的点,只要求输出点数即可.n<=50 因为数据量小, ...

  4. Codeforces Gym 100203G Good elements 暴力乱搞

    原题链接:http://codeforces.com/gym/100203/attachments/download/1702/statements.pdf 题解 考虑暴力的复杂度是O(n^3),所以 ...

  5. Codeforce Gym 100015I Identity Checker 暴力

    Identity Checker 题目连接: http://codeforces.com/gym/100015/attachments Description You likely have seen ...

  6. Gym - 101848B Almost AP 暴力

    题目链接:http://codeforces.com/gym/101848/problem/B 给出一串数字要你最多改动三个数字使这一串数字成为等差数列.因为最多改动三个数字所以可以先求出相邻两项的差 ...

  7. Gym 100342E Minima (暴力,单调队列)

    3e7暴力,800ms+过,单调队列维护区间最小值. #include<bits/stdc++.h> using namespace std; typedef long long ll; ...

  8. Gym - 101194L World Cup 暴力

    World CupInput file: Standard InputOutput file: Standard OuptutTime limit: 1 second Here is World Cu ...

  9. invalid code signing entitlement的通用暴力解决办法

    1.添加的一台苹果设备为开发机子后,打版本,说profile 没找到,报错 2.上传二进制文件到itunes connect ,报错 3.有时候还什么 appID 无效,报错 烦死他了 我的解决办法, ...

随机推荐

  1. The web.config file for this project is missing the required DirectRequestModule.

    The web.config file for this project is missing the required DirectRequestModule.   将应用程序集的模式由集成改为经典 ...

  2. WPF语言切换,国际化

    winform语言切换在每个窗口下面有一个.resx结尾的资源文件,在上面添加新字符串就好了: WPF语言切换跟winform不一样的地方在于需要自己添加资源文件,并且这个资源文件可以写一个,也可以写 ...

  3. 黑马SSM练习中 Oracle SQL代码

    -- 10张表 product member orders traveller order_traveller users role permission users_role role_permis ...

  4. linux 初始配置(centos)-网络和可视化界面

    1. 执行命令查看ip:ip addr 2. 如果没有或取到,要查看网卡是否启动,及ip配置是否正确,请先将ONBOOT改成yes,表示开机即启动 [lobin@localhost ~]$ cat / ...

  5. 监控数组与foreach绑定-Knockout.js

    html: <h2>Your seat reservations</h2> <table>    <thead>  <tr>         ...

  6. 极客学院年VIP卡原价260的F码,200出售

    F码是中国最大的IT职业在线教育平台——极客学院推出的VIP时间兑换码,凭此可在极客学院官网兑换年VIP,畅享平台上所有IT技术课程. 购买请点击 http://www.bejson.com/othe ...

  7. 【ZROI 537】贪心题 题解

    [ZROI 537]贪心题 题解 Link Solution 最大的一边直接放到一起贪心即可 着重讲小的一边 已知对于二分图匹配,其答案即为最大流 令时间集合为 \(T = {1,2,3,\dots, ...

  8. 从两个不同的ServiceProvider说起

    从两个不同的ServiceProvider说起 我们一致在说 ASP.NET Core广泛地使用到了依赖注入,通过前面两个系列的介绍,相信读者朋友已经体会到了这一点.由于前面两章已经涵盖了依赖注入在管 ...

  9. 次小生成树(SST)

    次小生成树(SST) 题目背景 Awson是某国际学校信竞组的一只菜鸡.Awson最近学了很多最小生成树的算法,Prim算法.Kurskal算法.消圈算法等等.正当Awson洋洋得意之时,信竞组其他大 ...

  10. NgStyle和NgIf控制HTML标签显示的区别

    通常web开发者会选择将元素样式属性display设为none来隐藏目标元素.采用这种方式,这些元素虽然不可见却仍然保存在DOM中,这样带来的好处是,如果元素不久就需要再次显示,组件不需要重新被初始化 ...