
acm
文章平均质量分 79
厌氧菌
学习中
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU 5954 Do not pour out 积分 二分 — 2016ACM-ICPC亚洲区沈阳站
原题见HDU 5954高为2,底面圆直径为2的开口杯,平放时里面装有高为d的水。问倾斜到不能再倾斜时(水不能溢出),水的表面积为多少?分析水面有两种可能的形状:椭圆或椭圆的一部分。其临界状况为: 此时椭圆经过杯底与杯口,得到被子恰好倾斜45°,空杯体积和水体积对称相等,故d=1。d>1时为椭圆。(杯子倾斜画得累了,直接让水倾斜吧)如图转载 2016-11-26 09:27:02 · 968 阅读 · 0 评论 -
Square Distance (构造)
Square DistanceTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 312 Accepted Submission(s): 102Problem DescriptionA string is原创 2016-10-01 11:36:55 · 533 阅读 · 0 评论 -
GCD is Funny (gcd + 想法)
GCD is FunnyTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 479 Accepted Submission(s): 128Problem DescriptionAlex has invent原创 2016-10-01 10:47:45 · 486 阅读 · 0 评论 -
SPOJ 7001 Visible Lattice Points (莫比乌斯反演)
题意:给定n*n*n的立方体,问从(0,0,0)点处能看到多少点,一个点能被看到当且仅当它与原点之间的连线上没有其他点。思路:假设一个点(x,y,z)能被看到,那么gcd(x,y,z)一定为1,这是因为如果这三者有公因数,那么除以公因数后的这个点一定在它与原点之间的连线上,所以我们要求的等价于(0,n)中任取三点(可以相等),且这三者的gcd为1的点的数量。这个问题就很类似经典莫比转载 2016-09-29 21:02:30 · 199 阅读 · 0 评论 -
HDU5930 gcd (线段树 + 二分)
GCDTime Limit: 9000/4500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 78 Accepted Submission(s): 11Problem DescriptionMr. Frog likes generating转载 2016-10-15 10:40:50 · 894 阅读 · 0 评论 -
Jam's problem again (找比点少的值)
Problem DescriptionJam like to solve the problem which on the 3D-axis,given N(1≤N≤100000) points (x,y,z)(1≤x,y,z≤100000)If two point such as (xi,yi,zi) and (xj,yj,zj) xi≥xj yi≥yj zi≥zj, the原创 2016-10-02 12:57:40 · 304 阅读 · 0 评论 -
hdu 5117 Fluorescent (求期望 + DP)
FluorescentTime Limit: 3000/3000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 576 Accepted Submission(s): 280Problem DescriptionMatt, a famous adv原创 2016-09-26 09:44:29 · 471 阅读 · 0 评论 -
poj 3469 Dual Core CPU ( 最小割)
题意:双核CPU,n个模块,每个模块必须运行在某个CPU核心上,每个模块在cpu单核的消耗A和B,M对模块要共享数据,如果在同一个核心上不用消耗,否则需要耗费。安排N个模块,使得总耗费最小思路:将两个cpu核心看成源点和汇点,其他模块分别与源点汇点连线(表示每个模块可以在任意cpu上运行),m对模块分别连双向边,要使得模块只能在一个cpu上运行,就是找到一个割,源点和汇点必原创 2016-08-13 14:59:31 · 232 阅读 · 0 评论 -
hdu 4762 Cut the Cake (概率 + java大数)
Problem DescriptionMMM got a big big big cake, and invited all her M friends to eat the cake together. Surprisingly one of her friends HZ took some (N) strawberries which MMM likes very much to de原创 2016-09-01 10:23:33 · 338 阅读 · 0 评论 -
UVA-11019 - Matrix Matcher(AC自动机)
题意:给出一个n*m的字符矩阵T,你的任务是找出给定的x*y的字符矩阵P在T中出现了多少次.分析:要想整个矩阵匹配,至少各行都得匹配。所以先把P的每行看做一个模式串构造出AC自动机,然后在T中的各行逐一匹配,找到P中每一行的所有匹配点。只要在匹配时做一些附加操作,就可以把匹配出来的单一的行拼成矩形。用一个d[r][c]表示T中一(r,c)为右上角,与P等大的矩形中有多少个完整的行和转载 2016-08-21 16:32:20 · 219 阅读 · 0 评论 -
Different GCD Subarray Query (离线的处理)
Problem DescriptionThis is a simple problem. The teacher gives Bob a list of problems about GCD (Greatest Common Divisor). After studying some of them, Bob thinks that GCD is so interesting. One d原创 2016-09-11 15:37:17 · 267 阅读 · 0 评论 -
hdu5875 Function (离线处理)
Problem DescriptionThe shorter, the simpler. With this problem, you should be convinced of this truth. You are given an array A of N postive integers, and M queries in the form (l,r).原创 2016-09-11 15:09:44 · 323 阅读 · 0 评论 -
hdu 5877 Weak Pair (树状树状 +dfs)
题目:Weak Pair链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5877题意:给一棵树和一个定值k,每个点的值w,对于两点(u、v),如果u 是v 的祖先,且w[u]*w[v]思路: 第一个要求u 是v 的祖先,那么可以dfs,遍历到v时,所有他上方的都是满足第一条件的u,做多了树就很容易想到在退出某个子树的时候消除这原创 2016-09-11 10:29:34 · 188 阅读 · 0 评论 -
HDU 5877 Weak Pair treap + dfs序
转载:http://www.itdadao.com/articles/c15a372922p0.html题意: 给出一棵n个结点的树和一个数k, 每个节点上有权值??, 问有多少个有序对(u,v) (u,v)满足u是v的祖先, a[u] * a[v] 题解: 最近学treap,发个题解 从根开始dfs, 用treap维护当前节点uu到根的节点权值序列,转载 2016-09-11 09:59:32 · 226 阅读 · 0 评论 -
Keep In Touch (dp 优化)
Keep In TouchTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Others)Total Submission(s): 469 Accepted Submission(s): 196Problem DescriptionThere are n原创 2016-10-01 15:02:59 · 325 阅读 · 0 评论 -
HDU5808Price List Strike Back (BestCoder Round #86 E) cdq分治+背包
转载:http://www.cnblogs.com/shuguangzw/p/5747478.html严格按题解写,看能不能形成sum,只需要分割当前sum怎么由两边组成就好#include #include #include #include #include using namespace std;const int IN转载 2016-10-01 16:01:34 · 290 阅读 · 0 评论 -
HDU4676 Sum Of Gcd (数论 + 分块)
来看答案怎么求? ∑i=LR∑j=i+1Rgcd(a[i],a[j])=∑i=LR∑j=i+1R∑d|gcd(a[i],a[j])ϕ(d)=∑dϕ(d)∑i=L,d|a[i]R∑j=i+1,d|a[j]R1后一项就是[L,R]这段区间内有多少个d的倍数。 cnt[d][x]代表前x项中d的倍数的个数。 原式可化为 ∑i=LR∑j=i+1Rgcd(a[i],a原创 2016-10-07 14:25:51 · 524 阅读 · 0 评论 -
Activation (概率DP)
Problem DescriptionAfter 4 years' waiting, the game "Chinese Paladin 5" finally comes out. Tomato is a crazy fan, and luckily he got the first release. Now he is at home, ready to begin his journe原创 2016-10-06 13:37:58 · 376 阅读 · 0 评论 -
hdu 5338 ZZX and Permutations (贪心+线段树+二分)
//http://www.cnblogs.com/kuangbin/p/3260076.htmlStringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 11 Accepted Submission(s)转载 2016-10-18 19:33:57 · 421 阅读 · 0 评论 -
Maze (概率DP)
MazeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 2468 Accepted Submission(s): 1035Special JudgeProblem DescriptionWhen wak转载 2016-10-05 11:14:32 · 286 阅读 · 0 评论 -
Card Collector (概率dP)
Card CollectorTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4126 Accepted Submission(s): 2070Special JudgeProblem Description原创 2016-10-05 10:10:05 · 896 阅读 · 0 评论 -
Binary Tree(构造)
Binary TreeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 795 Accepted Submission(s): 466Special JudgeProblem DescriptionThe原创 2016-10-04 15:36:53 · 393 阅读 · 0 评论 -
树分治(点分治模板)poj-1741 Tree
转载:http://blog.youkuaiyun.com/ezereal/article/details/52833620对于一棵有根树, 树中满足要求的一个数对所对应的一条路径,必然是以下两种情况之一:1、经过根节点2、不经过根节点,也就是说在根节点的一棵子树中对于情况2,可以递归求解,下面主要来考虑情况1。设点i的深度为Depth[i],父亲为Parent[i]。若i为根,则转载 2016-10-17 21:30:59 · 440 阅读 · 0 评论 -
Caves (树形DP)
C - CavesTime Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 3672DescriptionIt is said that the people of Menggol lived in ca原创 2016-10-17 21:28:49 · 743 阅读 · 0 评论 -
HDOJ 4418 Time travel (bfs + 高斯消元)
点击打开链接题意:有一根编号为0~n-1的数轴,起点编号为x,终点编号为y,从起点开始,每次可以走1~m步中的任意步数,如果走到头就返回。如果d为1,那么一开始的走的方向是逆着数轴的,如果d为0,那么一开始走的方向是顺着数轴的。特别的,如果起点是0或者n-1,那么方向一定是确定的,所以d=-1.问从起点到终点的期望步数。这道题有一个折返走的特殊现象,为了使得操作简便,可转载 2016-10-03 16:24:44 · 256 阅读 · 0 评论 -
Picnic Cows
Picnic CowsTime Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2599 Accepted Submission(s): 822Problem DescriptionIt’s summer voc原创 2016-10-03 15:06:23 · 338 阅读 · 0 评论 -
Division (斜率dp)
DivisionTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 999999/400000 K (Java/Others)Total Submission(s): 4348 Accepted Submission(s): 1709Problem DescriptionLittle D is re原创 2016-10-03 11:07:33 · 286 阅读 · 0 评论 -
Lawrence (斜率dp)
LawrenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3572 Accepted Submission(s): 1620Problem DescriptionT. E. Lawrence wa原创 2016-10-03 10:24:38 · 268 阅读 · 0 评论 -
HDU 5808 Price List Strike Back (cdq 分治)
Problem DescriptionThere are n shops numbered with successive integers from 1 to n in Byteland. Every shop sells only one kind of goods, and the price of the i-th shop's goods is vi. The d原创 2016-10-02 09:50:45 · 288 阅读 · 0 评论 -
hdu 1540 Tunnel Warfare (线段树 记录的信息)
Problem DescriptionDuring the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels原创 2016-08-08 15:27:19 · 184 阅读 · 0 评论 -
hdu 2896 病毒侵袭 ( ac 自动机 )
Problem Description当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋——我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸成为受害者之一。小t如此生气,他决定要把世界上所有带病毒的网站都找出来。当然,谁都知道这是原创 2016-08-08 13:52:29 · 231 阅读 · 0 评论 -
hdu3306 - Another kind of Fibonacci
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include原创 2016-07-14 16:52:51 · 232 阅读 · 0 评论 -
hdu3311 - Dig The Wells (斯坦纳树 spfa + DP)
#include #include #include #include #include #include using namespace std;typedef long long LL ;const LL mod=1000000009LL;const int N=10000;const int inf=0x3fffffff;int T;int n,m,k;struct edge{ int v,原创 2016-07-14 16:04:14 · 325 阅读 · 0 评论 -
hdu 4301 Divide Chocolate (dp )
Problem DescriptionIt is well known that claire likes dessert very much, especially chocolate. But as a girl she also focuses on the intake of calories each day. To satisfy both of the two desires原创 2016-07-25 14:33:41 · 302 阅读 · 0 评论 -
hdu 4381 Grid(背包 + 思维)
Problem Description There are n boxes in one line numbered 1 to n, at the beginning, all boxes are black. Two kinds of operations are provided to you:1 ai xi :You can choose any xi black boxe原创 2016-07-25 11:44:14 · 278 阅读 · 0 评论 -
hdu 5720 - Wool (线段交的长度)
Problem DescriptionAt dawn, Venus sets a second task for Psyche.She is to cross a river and fetch golden wool from violent sheep who graze on the other side.The sheep are wild and tameless原创 2016-07-25 09:48:16 · 278 阅读 · 0 评论 -
hdu1503 -Advanced Fruits
1.hdu 1503题意:给你两个字符串,要你用这两个字符串组成这样一个字符串,在组成的字符串中字符的相对顺序不变的情况下,可以在组成的字符串中找到原先两个字符串,字母可以错开,但是相对顺序不能变化,要这个组成的字符串中字母数最少,并输出这个字符串。Sample Inputapple peachananas bananapear peach Sample Ou原创 2016-07-12 19:23:19 · 319 阅读 · 0 评论 -
hdu 5727 - Necklace ( 环排列 + 二分图匹配)
Problem DescriptionSJX has 2*N magic gems. N of them have Yin energy inside while others have Yang energy. SJX wants to make a necklace with these magic gems for his beloved BHB. To avoid making原创 2016-07-23 14:31:25 · 428 阅读 · 0 评论 -
hdu 3032 Nim or not Nim?(打表 sg函数)
Nim or not Nim?Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 623 Accepted Submission(s): 288Problem DescriptionNim is a转载 2016-07-23 13:31:59 · 316 阅读 · 0 评论 -
hdu 5724 - chess (sg函数)
#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long LL;int sg[1<<21];bool h[25];void init_SG(){ memset(sg,0,sizeof转载 2016-07-22 15:59:36 · 312 阅读 · 0 评论