B. Bear and Compressing 题目链接  Problem - B - Codeforces   Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English…
E - Bear and Forgotten Tree 2 思路:先不考虑1这个点,求有多少个连通块,每个连通块里有多少个点能和1连,这样就能确定1的度数的上下界. 求连通块用链表维护. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PII pair<int, int> #define PLI pair<L…
E. Bear and Forgotten Tree 2 题目连接: http://www.codeforces.com/contest/653/problem/E Description A tree is a connected undirected graph consisting of n vertices and n  -  1 edges. Vertices are numbered 1 through n. Limak is a little polar bear. He once…
D. Delivery Bears 题目连接: http://www.codeforces.com/contest/653/problem/D Description Niwel is a little golden bear. As everyone knows, bears live in forests, but Niwel got tired of seeing all the trees so he decided to move to the city. In the city, N…
C. Bear and Up-Down 题目连接: http://www.codeforces.com/contest/653/problem/C Description The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: ti < ti + 1 for each odd…
B. Bear and Compressing 题目连接: http://www.codeforces.com/contest/653/problem/B Description Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only…
A. Bear and Three Balls 题目连接: http://www.codeforces.com/contest/653/problem/A Description Limak is a little polar bear. He has n balls, the i-th ball has size ti. Limak wants to give one ball to each of his three friends. Giving gifts isn't easy - th…
A. Bear and Three Balls time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Limak is a little polar bear. He has n balls, the i-th ball has size ti. Limak wants to give one ball to each of his…
传送门 A. Bear and Three Balls time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Limak is a little polar bear. He has n balls, the i-th ball has size ti. Limak wants to give one ball to each of…
这题思路很简单,二分m,求最大流是否大于等于x. 但是比赛过程中大部分的代码都被hack了... 精度问题,和流量可能超int 关于精度问题,这题真是提醒的到位,如果是先用二分将精度控制在10^-8左右,最后乘一个10^4,精度只能在10-4,而二分控制精度在10^-11很容易死循环(因为double 保存15-16位有效数字,结果可能为10^6级,精确到10-11,double做不到) 所以这题二分可以不写成while(d-b>eps),而直接规定二分的次数,设置成100次,基本可以保证14-…
1. Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) B. Batch Sort    暴力枚举,水 1.题意:n*m的数组,每行最多可交换1次,列最多可交换两列,问最终是否可以变换到每行都是1~m. 2.总结:暴力即可. #include<bits/stdc++.h> #define F(i,a,b) for (int i=a;i<b;i++) #define FF(i,a,b) for (int i=a;i&l…
xHTML+div经常考题:三个div,两边div宽度固定,中间div宽度自适应. 和大家分享一个实现方式: 1.html代码 <div class="dyleft">左栏固定宽度为200px</div> <div class="dyright">右栏固定宽度为200px</div> <div class="dycenter">中间自适应宽度</div> 2.css代码 bo…
作者:zccst <body> <div class="selected">1</div> <div class="selected">1</div><div class="selected">1</div> </body> Object[div.selected, div.selected, div.selected] HTMLCollection[…
这次是Div.1+Div.2,所以有7题. 因为时间较早,而且正好赶上训练,所以机房开黑做. 然而我们都只做了3题.:(. 链接. [A]声控解锁 题意: Arkady的宠物狗Mu-mu有一只手机.它需要朝这个手机吠一个英文单词密码(两个字符长),手机才能解锁. Mu-mu的仇敌,Kashtanka想要解锁Mu-mu的手机,但是它只会说一些两个字符长的英文单词. 它想要用某种顺序吠出若干个英文单词,使得手机能解锁.告诉Kashtanka它有没有可能做到这一点. 输入: 第一行一个两个字符长的字符…
Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) A. Single Wildcard Pattern Matching 题意就是匹配字符的题目,打比赛的时候没有看到只有一个" * ",然后就写挫了,被hack了,被hack的点就是判一下只有一个" * ". 代码: //A #include<iostream> #include<cstdio>…
本来兴致勃勃的想乘着这一次上紫,于是很早很早的到了机房 但是好像并没有什么用,反而rating-=47 Codeforces Round #438(Div.1+Div.2) 今天就这样匆匆的总结一下,心情不好qaq 首先是 A.Bark to Unlock 启示:(1)不能直接把char数组进行比较!!! (2)读题要读清,不能漏读条件!!! #include<bits/stdc++.h> using namespace std; ][],n; string s,t; int main(){…
Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)-D. Restore Permutation-构造+树状数组 [Problem Description] ​ 给你一个长度为\(n\)的数组,第\(i\)个元素\(s_i\)表示一个排列中第\(i\)个元素之前,并且小于\(p_i\)的元素的和.求出满足此条件的排列. [Solution] ​ 假设\(n=5\),\(s[]=\{0,0,3,7,3\}\).从后往前看…
Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)-C. Magic Grid-构造 [Problem Description] ​ 给你一个\(n\),构造一个\(n\times n\)的矩阵,使其满足任意一行,或一列的异或值相同.保证\(n\)能被\(4\)整除. [Solution] ​ 可以发现,从\(0\)开始,每\(4\)个连续数的异或值为\(0\),所以可以很容易使得每一行的异或值等于\(0\). ​ 列…
Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)-E. Let Them Slide-思维+数据结构 [Problem Description] ​ \(n\times w\)的方格中,每一行有\(cnt_i\)个数字,每一行的数字都连续的放在一起,但是可以任意的平移.问每一列的最大和为多少. [Solution] ​ 最直观的想法是对于每一列\(j\),计算出每一行中的一个区间最大值,此区间长度为\(len=w-c…
div覆盖div,出现div与div盒子之间产生重叠覆盖现象,而内容没有出现覆盖重叠现象原因与解决方法.DIVCSS5通过CSS图文案例介绍产生原因与解决方法.DIV与DIV覆盖原因与解决方法. 可能您遇到过上下结构的布局,下面DIV内容重叠上面DIV内容上,也可能下面内容覆盖掉上面DIV布局,形成DIV与DIV覆盖重叠现象;您也可能遇到过相邻的两个DIV盒子发生重叠覆盖现象,这些是什么问题如何解决? 接下来DIVCSS5通过案例来演示这两种兼容性DIV覆盖重叠现象问题,并解释原因与解决方法.…
下面介绍一下div嵌套div时margin不起作用的解决方案. 顺便科普下margin的定义和用法. div嵌套的HTML代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=…
Codeforces Round #792 (Div. 1 + Div. 2) A-E A 题目 https://codeforces.com/contest/1684/problem/A 题解 思路 知识点:数学. 显然长度大于等于3的数字串的最小数位是完全可以通过这些操作留到最后. 长度等于2的数字串只可能是个位数字. 时间复杂度 \(O(n)\) 空间复杂度 \(O(n)\) 代码 #include <bits/stdc++.h> using namespace std; int mai…
比赛链接:Dashboard - Codeforces Round #792 (Div. 1 + Div. 2) - Codeforces C. Column Swapping 题意: 给定一个n*m大小的二维数组,要求只进行一次两列交换,使得得到的新数组的每行都是不减的.特别的,允许交换的两列是相同列. 思路:构造 可以考虑复制一份数组,并将其排序,那么两个数组中出现数字大小不同的列就是需要进行交换的列. 设需要交换的列的数量为num: ◇ 当num=0,无需交换,可以直接选择交换1 1.◇…
C. Bear and Colors 题目连接: http://www.codeforces.com/contest/673/problem/C Description Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n.…
B. Guess the Permutation 题目连接: http://www.codeforces.com/contest/618/problem/B Description Bob has a permutation of integers from 1 to n. Denote this permutation as p. The i-th element of p will be denoted as pi. For all pairs of distinct integers i,…
A. Slime Combining 题目连接: http://www.lydsy.com/JudgeOnline/problem.php?id=2768 Description Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1. You are going to play a game with these slimes. Initi…
F. Double Knapsack 题目连接: http://www.codeforces.com/contest/618/problem/F Description You are given two multisets A and B. Each multiset has exactly n integers each between 1 and n inclusive. Multisets may contain multiple copies of the same number. Y…
E. Robot Arm 题目连接: http://www.codeforces.com/contest/618/problem/E Description Roger is a robot. He has an arm that is a series of n segments connected to each other. The endpoints of the i-th segment are initially located at points (i - 1, 0) and (i…
现在水平真的不够.只能够做做水题 A. Slime Combining 题意:就是给n个1给你.两个相同的数可以合并成一个数,比如说有两个相同的v,合并后的值就是v+1 思路:直接模拟栈 #include<iostream> #include<algorithm> #include<stack> using namespace std; ]; int main() { int n; while(cin >> n){ stack<int>p; p.…
div中图片垂直居中 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style> .box { width: 200px; height:200px; display: table-cell; /* 水平居中 */ text-align:center; /* 垂直居中 */ vertical-align:mid…