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

#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. Laravel框架中使用邮件发送功能

    这里是演示的用户注册之后,进行邮件激活的功能. 点击注册之后,系统会自动发送一个份邮件到注册者的邮箱,注册者点击链接激活账号. 先配置laravel中的(.env)文件 MAIL_DRIVER=smt ...

  2. json字符串与json对象之间的转换

    字符串转对象(strJSON代表json字符串)   var obj = eval(strJSON); (运用时候需要除了eval()以外需要json.js包)  var obj = strJSON. ...

  3. c# new三种用法

    前几天去家公司面试,有一道这样的题:写出c#中new关键字的三种用法,思前想后挖空心思也只想出了两种用法,回来查了下msdn,还真是有第三种用法:用于在泛型声明中约束可能用作类型参数的参数的类型,这是 ...

  4. 2017-9-9 NOIP模拟赛

    站军姿 2bc*cosA=b^2+c^2-a^2 #include<cstdio> #include<cstdlib> #include<cmath> #inclu ...

  5. Hadoop安装包下载方法

    Hadoop3.0版本的诞生,引入了很多新功能,为了验证Hadoop2.0与3.0版本的性能,需下载Hadoop的不同版本.故下文演示如何下载Hadoop安装包的方法. 1. 进入Apache Had ...

  6. 有关xerosploit运行报错问题的有效解决方案

    [安装xerosploit]安装xerosploit的步骤如下,我是将xerosploit直接克隆到了根目录下(使用“cd /”到达根目录) git clone https://github.com/ ...

  7. spring 公用异常处理

    1. 采用spring boot注解方式,如果采用swagger的话会导致swagger不可用 1.1  spring 配置如下 #出现错误时, 直接抛出异常 spring.mvc.throw-exc ...

  8. ASP.NET Core Linux

    环境说明 CentOS / 7.1 (64bit) (Linux操作系统) 3MySQL5.7(网站应用数据库) .NET Core SDK 2.0.0(网站应用环境) Nginx(反向代理服务器) ...

  9. Middleware-请求管道的构成

    Middleware-请求管道的构成 在 ASP.NET 中,我们知道,它有一个面向切面的请求管道,有19个主要的事件构成,能够让我们进行灵活的扩展.通常是在 web.config 中通过注册 Htt ...

  10. (转) Linux 下的dd命令使用详解(摘录)

    使用dd命令克隆整个系统------http://www.cnblogs.com/jikexianfeng/p/6103504.html 原文:https://www.cnblogs.com/jike ...