- 博客(27)
- 收藏
- 关注
原创 hdu 4919 Exclusive or
Exclusive orTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 377 Accepted Submission(s): 159Problem DescriptionGiven n, find
2014-08-06 16:35:16
592
原创 树状数组
1、概述树状数组(binary indexed tree),是一种设计新颖的数组结构,它能够高效地获取数组中连续n个数的和。概括说,树状数组通常用于解决以下问题:数组{a}中的元素可能不断地被修改,怎样才能快速地获取连续几个数的和?2、树状数组基本操作传统数组(共n个元素)的元素修改和连续元素求和的复杂度分别为O(1)和O(n)。树状数组通过将线性结构转换成伪树状结构(线性结构只能逐个
2014-07-31 10:23:36
472
转载 HDU4870 Rating(概率)
一个人有两个TC的账号,一开始两个账号rating都是0,然后每次它会选择里面rating较小的一个账号去打比赛,每次比赛有p的概率+1分,有1-p的概率-2分,当然如果本身是先考虑一场比赛的情况,定义dp[k]为当前为k分,要达到20分时的期望回合数。(令q=1-p)那么显然有 dp[0]=1+p*dp[1]+q*dp[0] 化简得 dp[0]=1/p+dp[1]
2014-07-23 20:00:10
429
原创 多校第一场Couple doubi
Couple doubiTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 150 Accepted Submission(s): 126Problem DescriptionDouBiXp has a g
2014-07-22 20:26:17
528
原创 hdu 2896 病毒侵袭
病毒侵袭Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10592 Accepted Submission(s): 2745Problem Description当太阳的光辉逐渐被月亮遮蔽,世界失去了光
2014-07-21 15:44:33
418
原创 uva 11404
#include#include#includeusing namespace std;char s1[1010],s2[2010];int maxs,temp;struct node{ int cmp; string str; bool operator > (node &a) {//重载 > 号,因为要按字典序决定答案 if (cmp
2014-07-09 16:11:45
430
原创 poj 3468 (线段树区间更新及求和)
# include # include # define MN 400000using namespace std;long long a[100005];struct node{ int left,right,mid; long long add,x;}tree[MN];void build(int le,int ri,int num)//构建一个线段树{ tree
2014-06-27 11:25:12
419
原创 hdu 1072 Nightmare(DFS)
NightmareTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6591 Accepted Submission(s): 3211Problem DescriptionIgnatius had a n
2014-06-17 14:50:40
485
原创 poj 2362 Square
SquareTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 19541 Accepted: 6797DescriptionGiven a set of sticks of various lengths, is it possible to join th
2014-06-15 22:57:20
458
原创 hdu 1728 逃离迷宫
逃离迷宫Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13952 Accepted Submission(s): 3325Problem Description 给定一个m × n (m行, n列)
2014-06-15 16:36:08
405
原创 UVA113 - Power of Cryptography
Power of CryptographyBackgroundCurrent work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo functions of these primes. Work in th
2014-04-02 14:16:12
411
原创 单调队列+DP
烽火传递 Description 烽火台又称烽燧,是重要的防御设施,一般建在险要处或交通要道上。一旦有敌情发生,白天燃烧柴草,通过浓烟表达信息:夜晚燃烧干柴,以火光传递军情。在某两座城市之间有n个烽火台,每个烽火台发出信号都有一定的代价。为了使情报准确的传递,在m个烽火台中至少要有一个发出信号。现输入n、m和每个烽火台发出的信号的代价,请计算总共最少需要话费多少代价,才能
2014-03-27 22:17:41
497
原创 单调队列之求最大和
hdu 3415 Max Sum of Max-K-sub-sequence #include#include#define MIN -1e10using namespace std;int sum[200050]={0},Q[200050];int main(){ int T,N,K,i,temp,maxs,start,ends; scanf("%d",&T
2014-03-26 15:08:59
499
原创 hdu4488 Faulhaber’s Triangle
DescriptionThe sum of the mth powers of the first n integersS(n,m) = SUM ( j= 1 to n)( jm)Can be written as a polynomial of degree m+1 in n:S(n,m) = SUM (k = 1 to m+1)(F(m
2013-08-13 09:48:41
562
原创 HDU 4489The King’s Ups and Downs(dp递推)
DescriptionThe king has guards of all different heights. Rather than line them up in increasing or decreasing height order, he wants to line them up so each guard is either shorter than the g
2013-08-13 09:38:19
872
原创 hdu 4399
DescriptionYou are given two strings s1[0..l1], s2[0..l2] and Q - number of queries.Your task is to answer next queries: 1) 1 a i c - you should set i-th character in a-th string to c; 2)
2013-08-08 16:00:25
1102
原创 hdu 1176
免费馅饼Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 19551 Accepted Submission(s): 6534Problem Description都说天上不会掉馅饼,但有一天gameboy正
2013-08-06 12:09:02
398
原创 hdu 1421(搬寝室)
搬寝室Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12989 Accepted Submission(s): 4382Problem Description搬寝室是很累的,xhd深有体会.时间追述200
2013-08-05 16:25:11
453
原创 hdu(数值计算 概率)
Candy Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionLazyChild is a lazy child who likes candy very much. D
2013-07-23 00:40:10
626
原创 线段树之poj 2777
Count ColorTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 30727 Accepted: 9174DescriptionChosen Problem Solving and Program design as an optional cours
2013-07-17 10:42:45
417
原创 线段树之Find the minimum
Find the minimumTime Limit: 2 Sec Memory Limit: 128 MBSubmit: 90 Solved: 22[Submit][Status][Web Board]DescriptionGiven an integer array of size N, we define two kind of operators:1.
2013-07-16 19:48:19
496
原创 并查集之poj 1308
Is It A Tree?Crawling in process...Crawling failedTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u DescriptionA tree is a well-known data structu
2013-07-06 19:12:39
569
原创 背包问题(poj2184)
Cow Exhibition Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Description: "Fat and docile, big and dumb, they look so stupid, they aren't muchfun.
2013-07-05 23:33:37
616
原创 典型背包问题
Bone CollectorTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10199 Accepted Submission(s): 3905Problem DescriptionMany years ago , in
2013-07-05 22:56:44
514
原创 动规之hdu3905--Sleeping
hdu3905--SleepingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 1495 Accepted Submission(s): 565Problem Description
2013-07-05 20:54:07
638
原创 单调队列之最大最小成员
poj2823_Sliding WindowCrawling in process...Crawling failedTime Limit:12000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u DescriptionAn array of size n ≤ 10
2013-07-05 13:02:21
721
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人