自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(62)
  • 收藏
  • 关注

转载 HDU 5954 Do not pour out 积分 二分 — 2016ACM-ICPC亚洲区沈阳站

原题见HDU 5954高为2,底面圆直径为2的开口杯,平放时里面装有高为d的水。问倾斜到不能再倾斜时(水不能溢出),水的表面积为多少?分析水面有两种可能的形状:椭圆或椭圆的一部分。其临界状况为: 此时椭圆经过杯底与杯口,得到被子恰好倾斜45°,空杯体积和水体积对称相等,故d=1。d>1时为椭圆。(杯子倾斜画得累了,直接让水倾斜吧)如图

2016-11-26 09:27:02 908

转载 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 365

原创 Little Tiger vs. Deep Monkey (二维线段树)

#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define L(i) i<<1#define R(i) i<<1|1#define INF

2016-10-17 21:33:20 725

转载 树分治(点分治模板)poj-1741 Tree

转载:http://blog.csdn.net/ezereal/article/details/52833620对于一棵有根树, 树中满足要求的一个数对所对应的一条路径,必然是以下两种情况之一:1、经过根节点2、不经过根节点,也就是说在根节点的一棵子树中对于情况2,可以递归求解,下面主要来考虑情况1。设点i的深度为Depth[i],父亲为Parent[i]。若i为根,则

2016-10-17 21:30:59 379

原创 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 674

原创 A Sequence of Numbers (dp)

A - A Sequence of NumbersTime Limit:20000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 3670DescriptionYou are given a sequence of N in

2016-10-16 10:50:48 453

转载 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 789

原创 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 475

原创 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 335

转载 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 251

原创 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 819

原创 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 305

转载 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 214

转载 HDU 5779 Tower Defence(Dp + 组合)

转载:http://blog.csdn.net/v5zsq/article/details/52086951Description 小白最近痴迷于玩Tower Defence。他想要自己制作一张地图。地图是一张有n个点的无向图(图可以不连通,没有重边和自环),所有边的长度都为1,满足从1号点到其他任意一个点的最短路都不等于k.小白想知道这样的图有多少个。如果

2016-10-03 15:26:51 280

原创 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 299

原创 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 226

原创 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 232

原创 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 247

原创 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 245

转载 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 253

原创 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 272

原创 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 459

原创 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 426

转载 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 161

原创 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 399

原创 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 217

原创 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 265

原创 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 151

转载 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 185

原创 Codeforces Working routine (链表)

题意:给一个大矩阵,只有操作交换两个相等小矩阵的元素,求k次交换后的矩阵思路:用链表存图,记录链接信息,每次修改边框的链接信息。注意修改后的矩阵,会影响后续操作。#include #include #include #include #include #include #include #include #include #include #include

2016-09-09 16:14:15 337

原创 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 281

转载 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 176

转载 hdu 5839 Special Tetrahedron (判断四面体)

Problem DescriptionGiven n points which are in three-dimensional space(without repetition).Please find out how many distinct Special Tetrahedron among them. A tetrahedron is called Special T

2016-08-15 15:35:23 236

原创 hdu 5834 Magic boy Bi Luo with his excited tree (树形dp)

Problem DescriptionBi Luo is a magic boy, he also has a migic tree, the tree has N nodes , in each node , there is a treasure, it's value is V[i], and for each edge, there is a cost C[i], wh

2016-08-15 15:29:15 235

原创 poj 3469 Dual Core CPU ( 最小割)

题意:双核CPU,n个模块,每个模块必须运行在某个CPU核心上,每个模块在cpu单核的消耗A和B,M对模块要共享数据,如果在同一个核心上不用消耗,否则需要耗费。安排N个模块,使得总耗费最小思路:将两个cpu核心看成源点和汇点,其他模块分别与源点汇点连线(表示每个模块可以在任意cpu上运行),m对模块分别连双向边,要使得模块只能在一个cpu上运行,就是找到一个割,源点和汇点必

2016-08-13 14:59:31 185

原创 hdu 5814 Knights ( dp状态设置)

Problem DescriptionAt the start of this game, there are N knights on a road of length N+1. The knights are numbered from 1 to N, and the ith knight stands i unit from the left end of the road.

2016-08-11 10:11:47 622

原创 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 148

原创 hdu 2896 病毒侵袭 ( ac 自动机 )

Problem Description当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋——我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸成为受害者之一。小t如此生气,他决定要把世界上所有带病毒的网站都找出来。当然,谁都知道这是

2016-08-08 13:52:29 193

原创 hdu Harmony Forever (线段树 )

Problem DescriptionWe believe that every inhabitant of this universe eventually will find a way to live together in harmony and peace; that trust, patience, kindness and loyalty will exist between

2016-08-07 16:03:58 249

原创 hdu 5800 To My Girlfriend (dp)

Problem DescriptionDear GuoI never forget the moment I met with you.You carefully asked me: "I have a very difficult problem. Can you teach me?".I replied with a smile, "of course"."I have n i

2016-08-07 11:04:49 163

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除