Codeforces Round 585
Codeforces Round 585
浅论如何发现自己是傻子的……
反正今天是完全蒙的,水了签到题就跑了……
A. Yellow Cards
签到题。
众所周知,CF的签到题一般是一道神神奇奇的数学题。思路2s出,细节一大堆……
当然,这个做法的时间复杂度并不优秀……
#include<bits/stdc++.h>
using namespace std;
int a1,a2,k1,k2,n,n1,n2,mmin,mmax;
int p[2010];
int main()
{
scanf("%d%d%d%d%d",&a1,&a2,&k1,&k2,&n);
n1=n;
n2=n;
for(int i=1;i<=a1;i++) {
p[i]=k1;
}
for(int i=1;i<=a2;i++) {
p[a1+i]=k2;
}
sort(p+1,p+a1+a2+1);
for(int i=1;i<=a1+a2;i++) {
if(n1-p[i]>=0) {
mmax++;
n1-=p[i];
}
else {
break;
}
}
for(int i=a1+a2;i>=1;i--) {
if(n2-p[i]+1>=0) {
n2-=(p[i]-1);
}
else {
break;
}
if(i==1) {
mmin=n2;
}
}
printf("%d %d",mmin,mmax);
return 0;
}
B. The Number of Products
死活不会做,弄了个前缀积,却发现不知道如何遍历。还一门心思去弄双指针……
C. Swap Letters
D. Ticket Game
E. Marbles
F. Radio Stations
耻辱啊,耻辱……
Codeforces Round 585的更多相关文章
- Codeforces Round #585 (Div. 2) D. Ticket Game
链接: https://codeforces.com/contest/1215/problem/D 题意: Monocarp and Bicarp live in Berland, where eve ...
- Codeforces Round #585 (Div. 2) C. Swap Letters
链接: https://codeforces.com/contest/1215/problem/C 题意: Monocarp has got two strings s and t having eq ...
- Codeforces Round #585 (Div. 2) B. The Number of Products(DP)
链接: https://codeforces.com/contest/1215/problem/B 题意: You are given a sequence a1,a2,-,an consisting ...
- Codeforces Round #585 (Div. 2) A. Yellow Cards(数学)
链接: https://codeforces.com/contest/1215/problem/A 题意: The final match of the Berland Football Cup ha ...
- B. The Number of Products(Codeforces Round #585 (Div. 2))
本题地址: https://codeforces.com/contest/1215/problem/B 本场比赛A题题解:https://www.cnblogs.com/liyexin/p/11535 ...
- A. Yellow Cards ( Codeforces Round #585 (Div. 2) 思维水题
---恢复内容开始--- output standard output The final match of the Berland Football Cup has been held recent ...
- Codeforces Round #585 (Div. 2)
https://www.cnblogs.com/31415926535x/p/11553164.html 感觉很硬核啊这场,,越往后越做不动,,,emmmm,,,(这场是奔着最后一题 2sat 来的, ...
- Codeforces Round #585 (Div. 2) [补题]
前言 2019.9.16 昨天下午就看了看D题,没有写对,因为要补作业,快点下机了,这周争取把题补完. 2019.9.17 这篇文章或者其他文章难免有错别字不被察觉,请读者还是要根据意思来读,不要纠结 ...
- Codeforces Round #585 (Div. 2) E. Marbles (状压DP)
题目:https://codeforc.es/contest/1215/problem/E 题意:给你一个序列,你可以交换相邻的两个数,要达到一个要求,所有相同的数都相邻,问你交换次数最少是多少 思路 ...
随机推荐
- 云开发 :云原生(Cloud Native)
云开发 :云原生(Cloud Native) 云原生 所谓云原生,它不是一个产品,而是一套技术体系和一套方法论,用于构建和运行充分利用云计算模型优势的应用.云计算将提供无限制的按需计算能力和根据使用情 ...
- swift 修改 Navigationbar Tabbar 字体颜色背景等属性
1.navigationBar的设置 let navColor = UIColor(red: 41/255, green: 160/255, blue: 230/255, alpha: 1) func ...
- Kafka运维大全来了!优化、监控、故障处理
Kafka运维大全来了!优化.监控.故障处理…… Kafka概念 Kafka是分布式发布-订阅消息系统.它最初由LinkedIn公司开发,之后成为Apache项目的一部分.Kafka是一个分布式的 ...
- IDEA 创建JAVA Maven Web 工程
转载自https://www.cnblogs.com/1314wamm/p/7475771.html 步骤一:首先先创建一个project,上次我说过了创建一个project就是一个工作空间,在这里就 ...
- flask 编码问题
在我们的flask项目中,通过表单提交对数据库进行更新的时候,数据提交不成功,提示以下内容: sqlalchemy.exc.InternalError: (pymysql.err.InternalEr ...
- mysql order by rand() 优化方法
mysql order by rand() 优化方法 适用于领取奖品等项目<pre>mysql> select * from user order by rand() limit 1 ...
- python format函数/print 函数详细讲解(4)
在python开发过程中,print函数和format函数使用场景特别多,下面分别详细讲解两个函数的用法. 一.print函数 print翻译为中文指打印,在python中能直接输出到控制台,我们可以 ...
- linux CentOS7 安装字体库-转
前言 报表中发现有中文乱码和中文字体不整齐(重叠)的情况,首先考虑的就是操作系统是否有中文字体,在CentOS 7中发现输入命令查看字体列表是提示命令无效: 如上图可以看出,不仅没有中文字体,连字体库 ...
- Image Perimeters
Description 给出一张由"x"和"."组成的矩阵.每个"x"可以向上下左右及两个斜对角进行连通,请问由某个点开始的"x& ...
- Python14之字符串(各种奇葩的内置方法)
一.字符串的分片操作 其分片操作和列表和元组一样 str1 = 'keshengtao' str1[2:6] 'shen' str1[:] 'keshengtao' str1[:4] 'kesh' 二 ...