摘要:题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=275题意:给你n个数,可以选择任意个数异或,但是要使得最后的异或值最大。我们把每个数用二进制表示,要使得最后的异或值最大,就是要让高位尽量为1,高位能不能为1就必须用高斯消元判断了。1. 根据数的二进制表示,建立方程组的矩阵,结果那列置为1。2. 从下往上高斯消元(高位放下面),如果该行有未被控制的变元,则该行的结果一定为1,且该变元控制该行。3. 从该行往上依次消掉(异或)该变元。4. 如果该行没有可以用来控制的变元,如果最后一列是0,则该行结果也为1,否则该行结果为0。这里能
阅读全文
摘要:题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=200200. Cracking RSAtime limit per test: 0.25 sec.memory limit per test: 65536 KBinput: standardoutput: standardThe following problem is somehow related to the final stage of many famous integer factorization algorithms involved in some crypto
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4815简单的DP题。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 using namespace std;12 const int MAXN = 40010;13 double dp[2][MAXN];14 int a[MAXN];15 int main()16 {17 //freopen("i...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4821字符串题。现场使用字符串HASH乱搞的。枚举开头! 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 using namespace std; 12 13 int HASH; 14 const int MAXN = 100010; 15 int now ; 16 struct H...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4813签到题。把一个字符串按照格式输出就可以了,很水 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 using namespace std;12 int main()13 {14 //freopen("in.txt","r",stdin);15 //freopen("ou
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4814进制转换。现场根据题目给的两个公式,不断更新!!!胡搞就可以了。现场3A,我艹,一次循环开大TLE,一次开小WA,太逗了,呵呵现场源码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 using namespace std;12 int a[200];13 int main()14 {15 ...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=48162013长春区域赛的D题。很简单的几何题,就是给了一条折线。 然后一个矩形窗去截取一部分,求最大面积。现场跪在这题,最后时刻TLE到死,用的每一小段去三分,时间复杂度是O(n log n) , 感觉数据也不至于超时。卧槽!!!!代码拷回来,今天在HDU一交,一模一样的代码AC了,加输入外挂6s多,不加也8s多,都可AC,呵呵·····(估计HDU时限放宽了!!!)现场赛卡三分太SXBK了,我艹!!!! 好好的一个现场赛绝杀错过了。以下是现场赛源
阅读全文