自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

vocaloid01的博客

菜鸡的笔记本~

  • 博客(33)
  • 收藏
  • 关注

原创 HDU4027——Can you answer these queries? (线段树区间更新求和+开根减枝+坑)

A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of end...

2018-05-29 19:52:30 327

原创 CSU - 1588 合并果子

现在有n堆果子,第i堆有ai个果子。现在要把这些果子合并成一堆,每次合并的代价是两堆果子的总果子数。求合并所有果子的最小代价。Input第一行包含一个整数T(T<=50),表示数据组数。每组数据第一行包含一个整数n(2<=n<=1000),表示果子的堆数。第二行包含n个正整数ai(ai<=100),表示每堆果子的果子数。Output每组数据仅一行,表示...

2018-05-29 17:13:51 149

原创 hdu4614——Vases and Flowers

Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers, she will try to put them in the vases, one flower in one vase. Sh...

2018-05-29 16:40:57 173

原创 POJ2528——Mayor's posters (线段树区间更新查询+离散化)

The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally d...

2018-05-28 18:54:15 277 2

原创 C++STL——unique函数总结

头文件:#include <iostream>参数:和sort一样。两个参数——开始地址和结束地址(左闭右开)。返回值:去重之后的尾地址!!!作用:unique的作用是“去掉”容器中相邻元素的重复元素。解析:unique实质上是一个伪去除,它并不是真正把重复的元素删除,而是用不重复的元素把重复的元素覆盖了,所以总长度其实是不变的。(注意,网上有人说是把重复元素移动到...

2018-05-28 15:30:24 879

原创 HDU 5618 Jam's problem again(CDQ分治+树状数组(三维模板题))

Jam 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 bi...

2018-05-23 18:56:11 170

原创 c++解决爆栈,手动加栈!

放在头文件前面#pragma comment(linker,"/STACK:1024000000,1024000000")

2018-05-23 17:00:46 2917 2

原创 POJ1741——Tree (树分治之点分治)

Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and v. Give an integer k,for every pair (u,v) of ver...

2018-05-22 21:09:49 248

原创 树分治之点分治模板总结

点分治的时间复杂度为O(nlogn)。由于每次都是找重心,所以处理完一个大小为N的树后,每个子树的大小最大都为N/2,所以最多分治NlogN层,每层都是N所以是O(NlogN)。【具体流程】1,选取一个点,将无根树变成有根树  为了使每次的处理最优,我们通常要选取树的重心。  何为“重心”,就是要保证与此点连接的子树的节点数最大值最小,可以防止被卡。  重心求法:   1。dfs一次,算出以每个点...

2018-05-22 19:09:14 356

原创 CodeForces - 243A——The Brand New Function (令人烦躁的思维题)

Polycarpus has a sequence, consisting of n non-negative integers: a1, a2, ..., an.Let's define function f(l, r) (l, r are integer, 1 ≤ l ≤ r ≤ n) for sequence a as an operation of bitwise OR of all th...

2018-05-21 10:57:58 468

原创 51Nod - 1013 3的幂的和

求:3^0 + 3^1 +...+ 3^(N) mod 1000000007Input输入一个数N(0 <= N <= 10^9)Output输出:计算结果Sample Input3Sample Output40题解:等比数列前(n+1)项和,公比为3首项为1所以t=( 3^(n+1)-1 ) / 2 % 1000000007。3^(n+1)用快速幂解决,而除法取模只需将除法变乘法即可...

2018-05-18 21:57:42 302

转载 JAVA 大数在acm中的应用

转载自:海克斯科技门1.首先,需要的头文件:import java.math.*; // 包含大数类的包 import java.util.*; // 包含输入头的包2.然后一个java程序的主体应该是这样:public class Main{ public static void main(String args[]){ ...

2018-05-18 21:23:35 335

原创 hdu1002 A + B Problem II(大数题)

I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1<=T<=20) which means the numbe...

2018-05-18 20:55:50 151

原创 邻接表基础常用模板

#define MAX_VEX 10//最大顶点数typedef int InfoType;typedef char VexType;//顶点的类型typedef int WeightType;//权值的类型 图的种类(有向图、无向图、加权有向图、加权无向图),采用枚举法(这一段可以选择性不写) typedef enum{ DG = 1, AG, WDG, WA...

2018-05-18 19:16:45 278

原创 HDU2089——不要62 (数位DP)

杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。例如: 62315 73418 88914 都属于不吉利号码。但是,61152虽然含有6和2,但不是62连号,所以不属于不吉利数字之...

2018-05-17 19:10:04 177

原创 ZOJ1610——Count the Colors (区间染色+暴力)

Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can see at las...

2018-05-17 15:01:07 276

原创 数位DP模板

typedef long long ll; int a[20]; ll dp[20][state];//不同题目状态不同 ll dfs(int pos,/*state变量*/,bool lead/*前导零*/,bool limit/*数位上界变量*/)//不是每个题都要判断前导零 { //递归边界,既然是按位枚举,最低位是...

2018-05-17 11:12:44 115

原创 HDU - 1540——Tunnel Warfare (线段树区间合并)

During 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 lay in a line. Except t...

2018-05-17 11:05:04 155

原创 hdu3911——Black And White (线段树区间合并)

Time limit3000 msMemory limit32768 kBThere are a bunch of stones on the beach; Stone color is white or black. Little Sheep has a magic brush, she can change the color of a continuous stone, black to w...

2018-05-16 18:57:10 214

原创 swap(a,b)值交换的4种方法

方法一:int tmp = 0; tmp = b; b = a; a = tmp; 方法二:a = a+b;b = a-b;a = a-b;方法三:a ^= b ^= a^= b;方法四:a = a+b-(b=a);

2018-05-16 16:42:30 3275

原创 POJ3264——Balanced Lineup(线段树查询区间最大最小值)

Time limit5000 msCase time limit2000 msMemory limit65536 kBFor the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game...

2018-05-15 21:46:22 141

原创 HDU1698——Just a Hook(线段树区间修改,区间求和)

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length.Now Pudge wan...

2018-05-15 20:36:15 201

原创 POJ3468——A Simple Problem with Integers (线段树区间加值,区间求和)

Time limit5000 msCase time limit2000 msMemory limit131072 kBYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to e...

2018-05-15 20:13:26 117

原创 HDU - 5023——A Corrupt Mayor's Performance Art(线段树+位运算压缩)

Time limit1000 msMemory limit100000 kBCorrupt governors always find ways to get dirty money. Paint something, then sell the worthless painting at a high price to someone who wants to bribe him/her on ...

2018-05-14 21:02:43 106

原创 线段树模板

首先是建树:const int MAXN = 1005;//定义 MAXM 为线段最大长度int Tree[4*MAXN];// Data数组为 main 函数中读入的内容,Tree数组为需要查询的数的信息(如和、最值等),树的空间大小为线段最大长度的四倍!四倍!四倍! int Data[MAXN];void Build(int temp,int left,int right){//传入...

2018-05-14 19:33:04 308

原创 CodeForces - 888C——K-Dominant Character(思维题)

You are given a string s consisting of lowercase Latin letters. Character c is called k-dominant iff each substring of s with length at least k contains this character c.You have to find minimum k suc...

2018-05-14 16:40:20 350

原创 CodeForces - 855E—Salazar Slytherin's Locket(数位DP)

Time limit2000 msMemory limit262144 kBHarry came to know from Dumbledore that Salazar Slytherin's locket is a horcrux. This locket was present earlier at 12 Grimmauld Place, the home of Sirius Black's...

2018-05-14 16:04:03 187

原创 HDU - 5898——odd-even number (数位DP)

Time limit1000 msMemory limit65536 kBFor a number,if the length of continuous odd digits is even and the length of continuous even digits is odd,we call it odd-even number.Now we want to know the amou...

2018-05-14 14:23:31 401

原创 HDU - 4632 Palindrome subsequence (区间DP)

In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence <A, B...

2018-05-14 09:32:51 128

原创 (树形DP入门)Anniversary party

There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tr...

2018-05-13 15:24:14 122

原创 祈福永无BUG

// _ooOoo_// o8888888o// 88" . "88// (| -_- |)// O\ = /O// ...

2018-05-12 21:39:47 1210

原创 O(nlogn) 求LIS(Longest Increasing Subsequence)方法的总结

前几天做题遇到求LIS的题,照常用dp去做结果超时了。之后就去网上找了O(nlogn)的方法。因为看了好几个博客我才看懂,所以这里我进行下总结。首先第一种写法:假设存在一个序列d[1..9] = 2 1 5 3 6 4 8 9 7,可以看出来它的LIS长度为5。下面一步一步试着找出它。我们定义一个序列B,然后令 i = 1 to 9 逐个考察这个序列。此外,我们用一个变量Len来记录现在最长算到多...

2018-05-07 20:25:59 372

原创 HDU - 3998 Sequence

There is a sequence X (i.e. x[1], x[2], ..., x[n]). We define increasing subsequence of X as x[i1], x[i2],...,x[ik], which satisfies follow conditions: 1) x[i1] < x[i2],...,<x[ik]; 2) 1<=i1 &...

2018-05-07 20:03:50 228

空空如也

空空如也

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

TA关注的人

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