随笔分类 - 比赛训练题解记录
摘要:贪心+模拟大法好! A、Reachable Numbers 思路:简单模拟。不难发现,通过f函数运算下去的步骤数量不会很多,所以暴力模拟,只要有一个数字第二次出现break即可。 AC代码: 1 #include <cstdio> 2 #include <cstring> 3 #include <c
阅读全文
摘要:A、Maxim and Biology 思路:简单贪心。分情况讨论即可。 AC代码: 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <iostream> 6 #i
阅读全文
摘要:本场题目不难,暴力模拟大法好。A~E:模拟+暴力(有些是贪心);F:留坑待填;G:埃氏筛+贪心。 A、Restoring Three Numbers 思路:简单数学。 AC代码: 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib
阅读全文
摘要:A、Mishka and Contest 思路:简单贪心。每次删掉首尾不超过k的元素,直到分别第一次遇到超过k的元素就不再继续删除即可。 AC代码: 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <c
阅读全文
摘要:A、Ilya and a Colorful Walk 思路:简单贪心。为了使得不相等的2个元素所在位置之间的距离最大,只需固定首尾元素分别扫一遍即可。 AC代码: 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #inc
阅读全文
摘要:A、The Doors 思路:红色为本题的解题要点,也就是Mr.Block从左往右依次打开每一个门,当第一次能打开左边出口或者右边出口的最后一个门所在的打开位置index就是要找的最小下标k。注意:题目已经保证了左右出口至少各有一个门,也就是说k一定是给定01序列中最后一个元素(与其右边相邻元素值不
阅读全文
摘要:A、Diverse Strings 思路:简单判断一下给定的字符串是否刚好为一个顺子即可。 AC代码: 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <iostr
阅读全文
摘要:题目链接:http://codeforces.com/contest/1065 解题思路:简单水过! AC代码: 解题思路:分别计算最小孤立点和最大孤立点的个数,不难,详解看代码。 AC代码: 解题思路:将高度升序排,然后从高到低,从上到下模拟切,每一刀要求最多只能切出k个小正方形。 AC代码:
阅读全文
摘要:题目链接:http://codeforces.com/contest/1077 解题思路:作差再判断最后是否还要向右跳一次即可。 AC代码: 解题思路:题意已说得很清楚了,只要找到满足a[i-1]==1&&a[i]==0&&a[i+1]==1,那么就关掉第i-1和第i+1间房间的灯(其状态值改为0)
阅读全文
摘要:###2018.10 A.oxx 的小姐姐们 oxx 和他的小姐姐(们)躺在图书馆前的大草坪上看星星。 有强迫症的 oxx 想要使得他的小姐姐们正好躺成一块 n×m 的长方形。 已知小姐姐的形状是 1×p 的长方形(可以横着或竖着躺)。小姐姐从 1 到 nm 编号总共有 nm 个(如果可以的话,绝对
阅读全文
摘要:Problem C zoj 4060 Flippy Sequence 解题思路:要求进行两次操作,每次操作选择一个区间,问将s串变成t串中所选的两个区间构成的4元组有多少个。做法:找出s串与t串不同块的个数,然后做个简单的判断即可。 AC代码: Problem E zoj 4062 Plants v
阅读全文
摘要:A-Magic Mirror Jessie has a magic mirror. Every morning she will ask the mirror: 'Mirror mirror tell me, who is the most beautiful girl in the world?'
阅读全文
摘要:F. Features Track Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat movement from a cat video. To do this,
阅读全文