codeforces div2 220 解题】的更多相关文章

这套题我只写了a, b, c..  对不起,是我太菜了. A:思路:就是直接简化为一个矩阵按照特定的步骤从一个顶角走到与之对应的对角线上的顶角.如图所示. 解释一下特定的步骤,就像马走日,象走田一样.你的步骤只能走(x-a, y-b), (x+a, y-b), (x-a, y+b), (x+a, y+b)这几种. 思路:假设高度为h, 宽度为w. 则如果 h%b==0&& w%a==0时,则一定能走到角落里. 还有一种走法:就是先是正常的碰撞,最后几下就斜着走.这样的规律就是 h/b%2=…
D. Count Good Substrings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. F…
C. Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept…
C. Predict Outcome of the Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n games in a football tournament. Three teams are participating in it. Currently k games had alread…
题目链接:http://codeforces.com/problemset/problem/31/C 题目意思:给出 n 个 lessons 你,每个lesson 有对应的 起始和结束时间.问通过删除一个lesson后能否使得所有lesson 持续的时间互不相交.注意,如果某个lesson结束的时刻恰好是另一个 lesson 的开始时刻,那么这两个lesson 也看作是不相交的. 看了题目之后,一如既往地,没什么想法= =.C题好多时候都这样,继续努力!!! 想着看Tutorial 直接学习,怎…
题目链接:http://codeforces.com/problemset/problem/499/B 题目意思:给出两种语言下 m 个单词表(word1, word2)的一一对应,以及 professor's lecture 的 n 个单词.问记下来的笔记是什么.对于professor's lecture 的某个单词,如果在单词表中找到,word1, word2 都有可能.如果 word1 的长度  <= word2 的长度,就输出word1,否则word2 考了map<string, st…
题目链接:http://codeforces.com/problemset/problem/495/C 题目意思:给出一串只有三种字符( ')','(' 和 '#')组成的字符串,每个位置的这个字符 '#'可以替换成不少于 1 个的 ')',问如何对每个'#'进行替换,使得对于字符串的任意一个位置, ')' 的数量始终不大于'(' 的数量.注意,'#'被替换成')'的总数以及原先有的')'的数量之和 == '(' 的总数. 花了两个晚上的一点时间,今天在图书馆里终于想到解决方案了,大感动 ~~~…
题目链接:http://codeforces.com/problemset/problem/490/B 题目意思:给出每个人 i 站在他前面的人的编号 ai 和后面的人的编号 bi.注意,排在第一个位置的人他前面是无人的!于是 a1 = 0.最后那个人的后面是木有人的,即 bn = 0.然后根据这些条件求出整个序列是如何排的,输出答案. 这条题卡了好久.........啊........啊........啊 首先很容易知道第二个位置的人的编号 和 倒数第二个人的位置编号.用一个aft[]数组记录…
这是本人写的第一次博客,学了半年的基础C语言,初学算法,若有错误还请指正. 题目链接:http://codeforces.com/contest/166/problem/E E. Tetrahedron                                                                           time limit per test2 seconds                                             …
题目链接:http://codeforces.com/problemset/problem/489/A 题目意思:给出一个 n 个无序的序列,问能通过两两交换,需要多少次使得整个序列最终呈现非递减形式.这个交换次数最多为 n 次.如果原来已经非递减排列好,输出次数为0:否则不但要输出次数,还需要输出每次交换的数组下标. 比赛的时候想复杂了,用了pair来记录值和坐标,还要开多一个pair类型的 b 数组来保存已排好序的序列,然后跟原序列比较......哪个复杂啊---然后校园网12:00 断网了…