上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 25 下一页
摘要: 一开始直接用递归求后一个分数式的值,每求一步约分一次,过了小数据,大数据没过……后来发现是因为中间两个long long相乘溢出了……看了别人的代码才明白,只要思维稍微转化一下,这题就能变得很简单…… 1 #include <cstring> 2 #include <cstdlib> 3 #include <cstdio> 4 #include <algorithm> 5 6 using namespace std; 7 8 #define LL long long int 9 10 const int MAXN = 100;11 12 int 阅读全文
posted @ 2013-05-20 08:47 冰鸮 阅读(576) 评论(0) 推荐(0)
摘要: 枚举两条竖线之间同时与这两条竖线相交的横线的个数cnt,这两条竖线之间能组成矩形的个数为:从cnt中任选两条横线的方案个数。将每两条竖线之间能组成矩形的个数加起来就是结果。 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <algorithm> 5 #include <vector> 6 7 using namespace std; 8 9 const int MAXN = 110;10 11 struct MyLine12 {13 in 阅读全文
posted @ 2013-05-18 23:11 冰鸮 阅读(231) 评论(0) 推荐(0)
摘要: 水动规= = 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 5 const int MAXN = 10010; 6 const char dic[26][10] = 7 { 8 ".-", "-...", "-.-.", "-..", 9 ".", "..-.", "--.", "....",10 "..&qu 阅读全文
posted @ 2013-05-18 21:03 冰鸮 阅读(259) 评论(0) 推荐(0)
摘要: 参考这里:http://blog.csdn.net/q775968375/article/details/8828952大神说的没错,这跟建树没有半毛线的关系,就是一DFS。。。 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 5 #define LL long long int 6 7 const int MAXN = 1010; 8 9 struct node10 {11 LL val, BitWide;12 node(): val(0), BitWide(0) { }13 阅读全文
posted @ 2013-05-14 18:36 冰鸮 阅读(324) 评论(0) 推荐(0)
摘要: 挺不错的一道线段树,薛神给的礼物,WA了整整一天才过,各种细节出错OTL……1.纵坐标扩大两倍保存,不然样例都跑不过。即(0, 2)与(3, 4)之间可以有一条横线,但是如果坐标不扩大,这条横线是过不去的。2.按x值从小到大排序,插入线段树,每次将Line[id]更新到线段树中之前,先查询编号为Line[id]向左可以看到哪几条线段(即可以看到哪几条编号比它小的线段),用vector保存,注意去重,不然最后结果会多。(vector忘了clear这里错了好几次。。。)3.id[MAXN]用来标记该段最顶端的线段的编号,-1代表该段没被覆盖或者该段不是被同一条线段覆盖4.四重循环暴力枚举,暂时也没 阅读全文
posted @ 2013-05-14 18:28 冰鸮 阅读(236) 评论(0) 推荐(0)
摘要: 因为0-15二进制下最大是1111,所以可以每个区间记录一下各个位上1的个数,这样不管是对于操作也好还是求和也好都简便了许多。PS1.感谢薛神提点。PS2.注意细节 1 #include <cstdio> 2 #include <cstdlib> 3 #include <cstring> 4 5 #define lson l, m, rt << 1 6 #define rson m + 1, r, rt << 1 | 1 7 8 const int MAXN = 1000002; 9 10 int cnt[ MAXN << 阅读全文
posted @ 2013-05-10 12:50 冰鸮 阅读(265) 评论(2) 推荐(0)
摘要: 1.代码1A率不高。尤其是我跟wkw,俩人总错在一些比较奇葩的地方。算是低级错误,可是如果老犯低级错误,那就是思维上有误区,有细节在敲的时候没注意到。2.没有互通题意。上一场有个题,我跟wkw都知道题意,都不会做,并且都忘了把题意告诉xgq,后来很晚的时候xgq才知道该题题意,觉得很简单,秒之。这一场有个题,我跟xgq都知道题意,都不会做,并且也是都忘了把题意告诉wkw,后来比赛快结束的时候wkw才知道题意,瞬间出思路,没时间敲了。你不会做的题,你队友未必不会做,比赛之中最好三个人都要知道所有题的题意。(以后我整理整理,把题意写纸上好了,我出思路的可能性不大……Orz)3.没有按题目难易程度决 阅读全文
posted @ 2013-05-10 10:46 冰鸮 阅读(153) 评论(0) 推荐(0)
摘要: 裸线段树,目前WA中。如果用离散化的话,就跟poj 2528 Mayor’s posters一样中间需要插点,之前样例一直跑不对就是这个原因。但这个做法依然不对,我这种做法相当于默认为位运算的运算顺序不影响结果,实际上对于位运算来说,混合运算不同的运算顺序不一定得到相同的结果。虽然花了很长时间很大功夫也没做出来,但是知道自己错在哪里也是一种收获。 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <algorithm> 5 6 #define lson 阅读全文
posted @ 2013-05-09 23:23 冰鸮 阅读(383) 评论(6) 推荐(0)
摘要: 待编辑需一步思路转化 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 5 #define lson l, m, rt << 1 6 #define rson m + 1, r, rt << 1 | 1 7 8 const int MAXN = 200001; 9 10 int pos[MAXN], val[MAXN];11 int sum[MAXN << 2];12 int ans[MAXN];13 int N, id;14 15 void b 阅读全文
posted @ 2013-05-09 14:02 冰鸮 阅读(155) 评论(0) 推荐(0)
摘要: 线段树矩形周长并 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <algorithm> 5 6 #define lson l, m, rt << 1 7 #define rson m + 1, r, rt << 1 | 1 8 9 using namespace std; 10 11 struct Seg_Tree 12 { 13 int l, r, h, s; 14 Seg_Tree() {} 15 Seg_Tree( i 阅读全文
posted @ 2013-05-09 13:52 冰鸮 阅读(191) 评论(0) 推荐(0)
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 25 下一页