code Gym 100500D T-shirts(暴力)
因为只能买一次,暴力枚举一下买的衣服的大小。
#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(暴力)的更多相关文章
- Codeforces gym 100685 A. Ariel 暴力
A. ArielTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/A Desc ...
- Codeforces Gym 100637G G. #TheDress 暴力
G. #TheDress Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/G ...
- Gym 101055A 计算几何,暴力
http://codeforces.com/gym/101055/problem/A 题目:给定一些三维空间的点,要你找一个平面,能覆盖尽量多的点,只要求输出点数即可.n<=50 因为数据量小, ...
- Codeforces Gym 100203G Good elements 暴力乱搞
原题链接:http://codeforces.com/gym/100203/attachments/download/1702/statements.pdf 题解 考虑暴力的复杂度是O(n^3),所以 ...
- Codeforce Gym 100015I Identity Checker 暴力
Identity Checker 题目连接: http://codeforces.com/gym/100015/attachments Description You likely have seen ...
- Gym - 101848B Almost AP 暴力
题目链接:http://codeforces.com/gym/101848/problem/B 给出一串数字要你最多改动三个数字使这一串数字成为等差数列.因为最多改动三个数字所以可以先求出相邻两项的差 ...
- Gym 100342E Minima (暴力,单调队列)
3e7暴力,800ms+过,单调队列维护区间最小值. #include<bits/stdc++.h> using namespace std; typedef long long ll; ...
- Gym - 101194L World Cup 暴力
World CupInput file: Standard InputOutput file: Standard OuptutTime limit: 1 second Here is World Cu ...
- invalid code signing entitlement的通用暴力解决办法
1.添加的一台苹果设备为开发机子后,打版本,说profile 没找到,报错 2.上传二进制文件到itunes connect ,报错 3.有时候还什么 appID 无效,报错 烦死他了 我的解决办法, ...
随机推荐
- 初步使用redis
1.导入jar包 2.新建类: public class JedisAdapter { private static final Logger logger = LoggerFactory.getLo ...
- HRBUST - 1214 NOIP2000提高组 方格取数(多线程dp)
方格取数 设有N*N的方格图(N<=10),我们将其中的某些方格中填入正整数,而其他的方格中则放人数字0.如下图所示(见样例 ,黄色和蓝色分别为两次走的路线,其中绿色的格子为黄色和蓝色共同走过的 ...
- Lightoj1059【最小生成树】
题意: 使得所有的位置都能通向一个机场,问最小花费. 思路: 最小生成树. 本来还想标记一下没有出现过的点,其实那个数组已经解决了.==. PS:注意路比建造机场还贵?直接造机场得了? if ther ...
- 多行文字超出字数部分省略(主要解决不兼容;display: -webkit-box;的浏览器)
注明:内容来处https://www.cnblogs.com/ss977/p/5846176.html 1.现webkit内核的浏览器支持display: -webkit-box;属性, 所以网页中显 ...
- 安装wepack
安装webpack之前要安装node.js 1.安装webpack运行 npm install webpack -g 和npm install webpack-cli -g npm install w ...
- unity打包选项编辑器扩展
using UnityEngine; using UnityEditor; using UnityEditor.Callbacks; using System.IO; public class Pos ...
- Web项目开发介绍及实战项目介绍
引言 本系列课程我们将学些Golang语言中的Web开发框架Iris的相关知识和用法.通过本系列视频课程,大家能够从零到一经历一个完整项目的开发,并在课程中了解实战项目开发的流程和项目设涉及的各个模块 ...
- uoj#399. 【CTSC2018】假面(概率期望)
传送门 记\(p_{i,j}\)为\(i\)还剩\(j\)滴血的概率,那么\(i\)最后血量的期望就是\[E_i=\sum_{j=0}^{m_i}j\times p_{i,j}\] 然后\(p\)数组 ...
- vue+element-ui实现无限级动态菜单树
使用vue+element-ui实现无限级动态菜单 该案例实现主要使用递归的思想,递归对新人来容易迷惑的是自己调用自己,直到满足条件为止,接下来我们就一步一步实现一个动态多级菜单vue组件 搭建项目并 ...
- LWIP学习之流程架构
一 STM32F107的网络接口配置:#include "stm32_eth.h" 1.1 打开网口时钟,响应IO配置.NVIC中断:通过调用Ethernet_Configurat ...