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 题意:给你一个序列,你可以交换相邻的两个数,要达到一个要求,所有相同的数都相邻,问你交换次数最少是多少 思路 ...
随机推荐
- git 本地项目推送到远程服务器
3进入本地电脑的将要上传的项目的目录下面 1)git init 初始化一个git 2) vim .gitignore 新增以及编写这个文件 node_modules/ 意思就是上传的时候忽略这个文件 ...
- Python3之内建模块datetime
datetime datetime是python处理日期和时间的标准库 获取当前日期和时间 >>> from datetime import datetime #获取当前的datet ...
- Docker 基础操作指南
Docker 基础操作指南 拉取基础镜像: docker pull centos:latest 根据基础的Centos镜像运行一个名为base-centos的容器 docker run --name ...
- C++ 枚举定义
我们在平常的编程中,时常需要为一些属性定义一组可以选择的值,比如文件打开的状态可能会有三种:输入 输出和追加 我们一般情况下记录这些状态是让每一个状态和一个常数相对应 比如 ; ; ; 这个方法虽 ...
- RocketMQ之一:RocketMQ整体介绍
常用MQ介绍及对比--<MQ详解及四大MQ比较> RocketMQ环境搭建--<RocketMQ之三:RocketMQ集群环境搭建> RocketMQ物理部署结构 Rocket ...
- C++ 用 vector 生成三维数组,并计算行、列、高
//Microsoft Visual Studio 2015 Enterprise //用vector生成三维数组,并计算行.列.高 #include <iostream> #includ ...
- 第五章 模块之 shtil 、 json / pickle、importlib、collections
5.8 shtil 高级的 文件.文件夹.压缩包 处理模块 shutil.rmtree 删除目录 import shutilshutil.rmtree(path) shutil.move 重命名:移动 ...
- Python爬虫刷回复
最近闲的无聊,就想着去看看爬虫,顺着爬虫顺利的做到了模拟登录.刷帖子等等,这里简要说一下. 使用Python2.7写的爬虫,对某论坛做模拟登陆和刷帖子.回复等等,由于之前是没有接触过爬虫,这次之后感觉 ...
- WUSTOJ 1349: TLE(Java)算法优化
题目链接:1349: TLE Description WH在刷题时,设计出了如下代码: #include<stdio.h> int main() { int i, j, cnt, k, N ...
- 创建 Python Virtualenv 虚拟隔离环境
video:创建 Python Virtualenv 虚拟隔离环境 python 虚拟环境 venv 简单用法 - littlemore - 博客园 创建 Python Virtualenv 虚拟隔离 ...