摘要: 【吐槽】 1.发烧打吊瓶,晚上坚持不住睡着了,没赶上比赛…… 2.CF的官方英文题解出的真是够慢的…… 3.cin cout什么的能用就用了管他慢不慢……我就懒死……==============================================================================================【A Tiling with Hexagons】 http://codeforces.ru/contest/216/problem/A 题目大意:对边平行且相等的大六边形里面排列若干小六边形,大六边形的边长n表示在这条边的方向上排列着n... 阅读全文
posted @ 2012-08-15 18:49 Delostik 阅读(551) 评论(0) 推荐(0) 编辑
摘要: 【250】 Beaver Bindu has some colored bricks. Each color is described by an uppercase letter. Bricks of each color all look exactly the same. You are given a string bricks. Each character of bricks represents the color of one of Bindu's bricks. Bindu wants to arrange all her bricks into a ... 阅读全文
posted @ 2012-08-05 02:40 Delostik 阅读(502) 评论(0) 推荐(0) 编辑
摘要: 【A System of Equations】 http://www.codeforces.com/contest/214/problem/A 题目大意:给定n,m,问有多少二元组(a,b)满足 ,其中a,b>0。 由于n很小,直接枚举a,b的值即可,复杂度O(n²)。#include <iostream>using namespace std;int n,m;long long ans=0;int main(){ cin>>n>>m; for(int i=0;i<=1000;i++) for(int j=0;j<=1000;j+ 阅读全文
posted @ 2012-07-31 16:29 Delostik 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 【208A Dubstep】 http://codeforces.ru/problemset/problem/208/A 题目大意:一个句子被添加了若干“WUB”,问原句。 将WUB去掉就行了,在句首或句尾直接删除,在句中替换成空格,注意多个“WUB”相连时特判。#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>using namespace std;char s[3000];int len;bool exist;int main(){ scanf(&q 阅读全文
posted @ 2012-07-24 18:44 Delostik 阅读(611) 评论(0) 推荐(0) 编辑
摘要: 102. Coprimestime limit per test: 0.5 sec. memory limit per test: 4096 KBFor given integer N (1<=N<=104) find amount of positive numbers not greater than N that coprime with N. Let us call two positive integers (say, A and B, for example) coprime if (and only if) their greatest common divisor 阅读全文
posted @ 2011-08-16 12:32 Delostik 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 101. Dominotime limit per test: 0.5 sec. memory limit per test: 4096 KBDominoes – game played with small, rectangular blocks of wood or other material, each identified by a number of dots, or pips, on its face. The blocks usually are called bones, dominoes, or pieces and sometimes men, stones, or ev 阅读全文
posted @ 2011-08-16 12:17 Delostik 阅读(366) 评论(0) 推荐(0) 编辑
摘要: 128. Snaketime limit per test: 0.5 sec. memory limit per test: 4096 KBThere are N points given by their coordinates on a plane. All coordinates (xi,yi) are integers in a range from -10000 up to 10000 inclusive . It is necessary to construct a broken line satisfying the following conditions:1. The br 阅读全文
posted @ 2011-08-15 18:45 Delostik 阅读(416) 评论(0) 推荐(0) 编辑
摘要: http://www.zybbs.org/JudgeOnline/problem.php?id=1443 此题竟然被改造出现在NOI2011的赛场上…… 半年前qz神牛在回宿舍的路上跟我吐槽这道题的捉法,但是被我忘干净了。NOI出现这道题我庆幸自己只是参加了同步赛,要不然就挂了。 膜拜过qz和CLJ的题解之后搞定了这个题。------------------------------Clavichord Orz----------------------------WJMZBMR Orz---------------------------------------- 我们想象棋盘被黑白染色,那. 阅读全文
posted @ 2011-08-14 09:37 Delostik 阅读(1134) 评论(0) 推荐(1) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2222 今天学习了一下Aho-Corasick Automation。以前学了trie之后就停止搞字符串这方面了,因为今年NOI出现了AC自动机,所以要学习一下。 这个题目的代码很多,我只是贴出来纪念一下第一道AC自动机,我也是跟别人学的。希望做的题多了,我也可以形成自己的风格(这个风格就比较符合我了)…… 加油!#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#in 阅读全文
posted @ 2011-08-11 21:42 Delostik 阅读(217) 评论(0) 推荐(0) 编辑
摘要: http://www.zybbs.org/JudgeOnline/problem.php?id=1106 http://main.edu.pl/en/archive/oi/14/tet 题目大意:诶呀我不说了就是个消方块的游戏和祖玛似的…… 肿么搞这个题呢?首先如果对于两个相同数字的方块,如果他们之间还有可以配对的两个方块,显然先消掉中间的方块更优。但是如果他们之间有k个无法配对的方块,我们就至少需要k次交换消掉现在的这两块。我们就可以统计一下每两个相同的方块之间有多少无法配对的方块。可以用一个树状数组来维护…… #include <iostream>#include <cs 阅读全文
posted @ 2011-08-11 16:55 Delostik 阅读(510) 评论(0) 推荐(0) 编辑
摘要: 八中链接http://www.zybbs.org/JudgeOnline/problem.php?id=1103 原题链接http://main.edu.pl/en/archive/oi/14/meg 题目大意:给你一棵树(仔细揣摩题目描述,是树),边有权(1或0),每个询问问从1到x的路径上权值和是多少。 看完我就在想LCT乱搞……然后发现LCT有点高射炮打蚊子了。后来发现这个题可以线性维护DFS序列来做,用线段树。 (PS:其实我写树状数组…………)#include <iostream>#include <cstdio>#include <cstring> 阅读全文
posted @ 2011-08-11 13:56 Delostik 阅读(615) 评论(0) 推荐(0) 编辑
摘要: http://www.zybbs.org/JudgeOnline/problem.php?id=2243 题目大意:给你一棵树,节点有颜色,要求可以查询某路径中连续颜色段的数目和修改某一段路径的颜色。 两次拉实之后查询和修改即可。 #include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <queue>#define NIL LCT#define MM 200001#define MN 100001using namespace s 阅读全文
posted @ 2011-08-11 10:25 Delostik 阅读(490) 评论(0) 推荐(0) 编辑
摘要: http://www.zybbs.org/JudgeOnline/problem.php?id=1102 八中题目描述太DT了……还是看这里: http://main.edu.pl/en/archive/oi/14/grz 水题不解释……(我颓废了) bfs记录一下高度相同的联通块,然后暴力枚举联通块的周围有木有比他还高(矮)的……完了……#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>using namespace std;const int px[ 阅读全文
posted @ 2011-08-11 10:18 Delostik 阅读(397) 评论(0) 推荐(0) 编辑
摘要: http://www.zybbs.org/JudgeOnline/problem.php?id=1100 这个题乍一看是计算几何题,其实吧…… 首先我们需要知道一个结论:一个轴对称图形旋转小于180的角,能够跟自己恰好重合k次,则该图形有k个对称轴。 那么这个题的难点就是,如何找到图形的中心进行旋转。中心是很难找的(至少我不会),所以我们需要一些特殊的方法…… 轴对称图形还有的性质就是:任意一点沿对称轴翻折能与另一点重合,任意一条边也是如此。 那么我们是否可以通过点和边得特征来判断是不是重合呢?答案是肯定的。 这样我们就可以用一个数组来记录点和边的特征,这样题目就由几何问题转化成为匹配问题。. 阅读全文
posted @ 2011-08-10 16:47 Delostik 阅读(494) 评论(0) 推荐(0) 编辑
摘要: http://www.zybbs.org/JudgeOnline/problem.php?id=1098 题目大意:给定一个N个点M条边的无向图,将N个点分成尽量多的组,满足任意两个不在同一组的点之间都有边。 此题的答案就是原图补图的联通块个数。具体在WC2011 MT的课件中有。 原话是:将未访问点挂链,扩展一个点时,标记原图中该点的相邻点,遍历链表,将所有未标记点(即该点在补图中的邻居)入队并从链表中删除。 然后我就根据这个很笨拙地串了一条链……#include <iostream>#include <cstdio>#include <cstring># 阅读全文
posted @ 2011-08-09 16:17 Delostik 阅读(633) 评论(0) 推荐(0) 编辑