摘要: You are given a sequence {A1, A2, ..., AN}. You task is to change all the element of the sequence to 1 with the following operations (you may need to 阅读全文
posted @ 2016-05-06 19:05 as3asddd 阅读(403) 评论(0) 推荐(0) 编辑
摘要: 最近准备练习一下最短路,详情见vjudge //[kuangbin带你飞]专题四 最短路练习 1.POJ 2387 A - Til the Cows Come Home Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I 阅读全文
posted @ 2016-05-03 14:59 as3asddd 阅读(223) 评论(0) 推荐(0) 编辑
摘要: Description Description You're given a list of n strings a1, a2, ..., an. You'd like to concatenate them together in some order such that the resultin 阅读全文
posted @ 2016-05-02 10:19 as3asddd 阅读(402) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=5667 题意:如题给了一个函数式,给你a,b,c,n,p的值,叫你求f(n)%p的值 思路:先对函数取以a为底的log,令g(n)=log(a)(f(n)),结果就能得到 g(n)=b+c*g(n-1)+g( 阅读全文
posted @ 2016-04-27 10:31 as3asddd 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=5666 题意:给一条直线x+y=q,在(0,0)往x+y=q上面的整数点连线,x+y=q与x,y轴截成的三角形内部,有多少个整数点,除了直线上的点,q是指数。 思路:首先两点之间的整数点有个公式,设A(x1, 阅读全文
posted @ 2016-04-25 14:59 as3asddd 阅读(269) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=5672 题意:有一个字符串S,字符串里面只包含小写字母,问有多少个子串里面有至少K个不同的字母; 思路:还是放在代码里面说会好一点,其实就是维护一个左端点和满足性质的最小右端点的过程。 1 #include 阅读全文
posted @ 2016-04-25 14:07 as3asddd 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 首先来认识一下网络流中最大流的问题 给定一个有向图G=(V,E),把图中的边看做成管道,边权看做成每根管道能通过的最大流量(容量),给定源点s和汇点t,在源点有一个水源,在汇点有一个蓄水池,问s-t的最大水流量是多少 网络流图里,源点流出的量等于汇点流入的量,除源汇外的任何点,其流入量之和等于流出量 阅读全文
posted @ 2016-04-21 16:26 as3asddd 阅读(681) 评论(0) 推荐(0) 编辑
摘要: 大致思路就是先求出n的质因数假设是a1-an,然后在1-a的区间里面查找至少能整除{a1,a2...an}中一个元素的数有多少个,对1-b也做相同的处理,而找出来的元素肯定是与n不互质的,那么把区间的长度减去元素的个数就是那个区间里面与n互质的数的个数了,然后1-b的减去1-(a-1)的就是答案了。 阅读全文
posted @ 2016-04-18 11:25 as3asddd 阅读(451) 评论(0) 推荐(1) 编辑