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 题意:给你一个序列,你可以交换相邻的两个数,要达到一个要求,所有相同的数都相邻,问你交换次数最少是多少 思路 ...
随机推荐
- CSS3 Transition 过渡
CSS3属性中有关于制作动画的三个属性:Transform,Transition,Animation: Transition:对元素某个属性或多个属性的变化,进行控制(时间等),类似flash的补间动 ...
- 爬虫存储介质之MongoDB存储
常用数据库 mongoDB4.0: 下载:https://www.mongodb.com/ windows安装.Linux安装见: https://www.runoob.com/mongodb/mon ...
- linux c基础技巧
C语言:向文件末尾进行追加数据https://blog.csdn.net/qq_31243065/article/details/82354557 https://zhidao.baidu.com/q ...
- LeetCode 230. 二叉搜索树中第K小的元素(Kth Smallest Element in a BST)
230. 二叉搜索树中第K小的元素 230. Kth Smallest Element in a BST 题目描述 给定一个二叉搜索树,编写一个函数 kthSmallest 来查找其中第 k 个最小的 ...
- 【转帖】如果进入CPU的世界,时间会是怎样的?
如果进入CPU的世界,时间会是怎样的? 2018-02-26 20:52:46 world6 阅读数 1295更多 分类专栏: 网络 缓存服务 架构 版权声明:本文为博主原创文章,遵循CC 4.0 ...
- java当中JDBC当中Scrollable和Updatable ResultSet的用法和Helloworld例子
[学习笔记] 在前面的jdbc的Helloworld程序当中,我们接触了最简单的 Statement.那种Statement的光标只能向前移.意思就是访问完2,只能继续访问3,不能再回过头来访问1.还 ...
- 题解 CF1216B 【Shooting】
题目大意:给你n个数,让你找到一种排列方式,使得$\sum\limits_{i=1}^{n}a[i]*(b[i]-1)$($b$为$a$的一种排列)最小 应该可以一眼看出是贪心,因为大的放前面先射击一 ...
- php数组与数据栈相关函数
php数组可以用栈的角度来操作,这其中包含了如下函数,array_pop(),array_push,array_shift(),array_unshift(). array_pop()函数 将数组的最 ...
- Python学习-55 小游戏- 猜大小
#游戏开始,首先玩家选择大小,选择完成后开始摇骰子(11<=总值<=18为大,3<=总值<=10为小) import random def roll_dice(numbers= ...
- Python进阶:metaclass谈
metaclass 的超越变形特性有什么用? 来看yaml的实例: import yaml class Monster(yaml.YAMLObject): yaml_tag = u'!Monster' ...