摘要: odd-even number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 716 Accepted Submission(s): 385 P 阅读全文
posted @ 2016-09-26 22:57 hxer 阅读(638) 评论(0) 推荐(0) 编辑
摘要: Calculation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2272 Accepted Submission(s): 536 Prob 阅读全文
posted @ 2016-09-26 20:10 hxer 阅读(725) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://poj.org/problem?id=3740 题意: 是否从0,1矩阵中选出若干行,使得新的矩阵每一列有且仅有一个1? 原矩阵N*M $ 1<= N <= 16 $ , $ 1 <= M <= 300$ 解法1:由于行数不多,二进制枚举选出的行数,时间复杂度为O((1<< 阅读全文
posted @ 2016-08-18 16:27 hxer 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5545 题意:有N个村庄, M 个战场; $ 1 <=N,M <= 10^5 $; 其中曹操会从第i个村庄中选出若个人 在x[i]战场为其作战, 同时第i个村庄也会有相同的人数在y[i]战场为袁绍作战; 阅读全文
posted @ 2016-08-15 15:30 hxer 阅读(376) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://poj.org/problem?id=1201 题意:给定n(1<= n <= 50000)个 闭区间,每个区间后面带一个值 Ci, 问集合Z个数的最小值使得在每个区间中的数的个数 “不少于Ci”? 思路: S[i] 表示 小于等于i 的个数,这样可以直接按照输入建立不等式 阅读全文
posted @ 2016-08-07 10:06 hxer 阅读(206) 评论(0) 推荐(0) 编辑
摘要: Description You are given a tree with N nodes. The tree’s nodes are numbered 1 through N and its edges are numbered 1 through N − 1. Each edge is asso 阅读全文
posted @ 2016-08-07 09:57 hxer 阅读(336) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2256 题意:给定 n 求解 ? 思路: , 令 , 那么 , 得: 得转移矩阵: 但是上面求出来的并不是结果,并不是整数。需要加上, 由于 所以结果为 阅读全文
posted @ 2016-08-01 01:35 hxer 阅读(273) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=5451 题意:给定x 求解 思路: 由斐波那契数列的两种表示方法, 之后可以转化为 线性表示 F[n] = F[n-1] + F[n-2] ; 同时可以看出 和 是 一元二次方程的两根, a = 1, b = -1 阅读全文
posted @ 2016-08-01 00:57 hxer 阅读(332) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=5769 题意:在S串中找出X串出现的不同子串的数目? 其中1 <= |S| < $10^5$ 官方题解: 处理出后缀数组中的sa[]数组和height[]数组。在不考虑包含字符X的情况下,不同子串的个数为 如果要求 阅读全文
posted @ 2016-07-31 23:37 hxer 阅读(218) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=5755 题意:一个N*M的矩阵,改变一个格子,本身+2,四周+1.同时mod 3;问操作多少次,矩阵变为全0.输出次数和具体位置 由于影响是相互的,所以增广矩阵的系数a[t][t+1] 或者是 a[t+1][t]均 阅读全文
posted @ 2016-07-27 22:02 hxer 阅读(358) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5690 题意:m个数字全为x mod k ?= c;其中m <= 1010,0 < c,k <= 10,000; 法1:xxx = (10m-1)/9*x;但是n太大,需要同时mod。去除分母将式子变为: 阅读全文
posted @ 2016-07-24 23:15 hxer 阅读(408) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5738 题意:从n(n <= 1000)个点(有重点)中选出m(m > 1)个点(选出的点只看标号,不看具体坐标)合成一个集合,问集合中的点共线(可以重合)的集合个数? 思路:按照x,y双关键字排序,之后 阅读全文
posted @ 2016-07-24 22:57 hxer 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5719 题意:一个数列为1~N的排列,给定mn[1...n]和mx[1...n],问有符合的排列数为多少?如果不存在,输出0; 思路: 有解的几种条件: 1. mn , mx 变化单调; 2. mn,mx 阅读全文
posted @ 2016-07-24 22:38 hxer 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5720 题意:有n(n <= 105)个数 ,每个数小于等于 1018;问在给定的[L,R]区间中,有多少个数不能与已知的n个数中的任何两个组成三角形? 思路:由三角形的边长关系移位即可得到符合关系的长度 阅读全文
posted @ 2016-07-24 22:26 hxer 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=5724 题意:一个n*20的棋盘,n <= 1000;棋盘上有一些棋子,每颗棋子只能移动到右边的第一个空格。不能移动者输;其中 Alice先手;如果Alice能赢输出"YES"; 思路:每个子游戏的大小只有2 阅读全文
posted @ 2016-07-24 22:15 hxer 阅读(295) 评论(0) 推荐(0) 编辑