6955专题

HDU - 6955 Xor sum【01字典树】

要点:01-trie,前缀异或和, 每个结点存储当前最右位置,查询时去找满足大于k的最右位置,如果存在等于k的情况,则一定是for循环结束后才会出现的情况。 发现一个bug:int数值的右移不能大于31,否则不会得到准确值,如果非要连续除以2的次数达到31次以上(不包括31),只能进行循环。 #include <cstdio>#include <algorithm>using namespa

Finding Lines UVALive 6955(rand随机化过题 )

题意:给 n(10^5)个点,问是否满足超过%p的点在同一条直线上。  #include <bits/stdc++.h>using namespace std;int x[101000],y[101000];using namespace std;bool judge(int a, int b, int c)//判断三点是否共线{return (y[b] - y[a]) * (x[