- 博客(16)
- 资源 (3)
- 收藏
- 关注
转载 树状数组
树状数组树状数组是对一个数组改变某个元素和求和比较实用的数据结构。两中操作都是O(logn)。 在解题过程中,我们有时需要维护一个数组的前缀和S[i]=A[1]+A[2]+...+A[i]。 但是不难发现,如果我们修改了任意一个A[i],S[i]、S[i+1]...S[n]都会发生变化。 可以说,每次修改A[i]后,调整前缀和S[]在最坏情
2014-10-30 22:04:41 313
原创 hdu 1194
#include int main(){ int t, a, b; scanf("%d", &t); while (t--){ scanf("%d %d", &a, &b); if (a < b||(a%2==0&&b%2==1)||(a%2==1&&b%2==0)) printf("impossible\n");
2014-10-30 21:26:42 410 1
转载 过山车 (二分图,求最大增广路径)
【书本上的算法往往讲得非常复杂,我和我的朋友计划用一些简单通俗的例子来描述算法的流程】匈牙利算法是由匈牙利数学家Edmonds于1965年提出,因而得名。匈牙利算法是基于Hall定理中充分性证明的思想,它是部图匹配最常见的算法,该算法的核心就是寻找增广路径,它是一种用增广路径求二分图最大匹配的算法。-------等等,看得头大?那么请看下面的版本:通过数代人的努力,你终
2014-10-26 19:51:01 1959
原创 hdu 1073 Online Judge
Problem DescriptionIgnatius is building an Online Judge, now he has worked out all the problems except the Judge System. The system has to read data from correct output file and user's result file
2014-10-25 11:52:01 446
转载 hdu 1527
Problem Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。 Input输入包含若干行,表
2014-10-21 17:37:33 483
原创 hdu 1250
Problem DescriptionA Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(n>4) = F(n
2014-10-21 16:32:20 522
原创 hdu 3351
Problem DescriptionI’m out of stories. For years I’ve been writing stories, some rather silly, just to make simple problems look difficult and complex problems look easy. But, alas, not for this o
2014-10-19 21:25:54 471
原创 hdu 1014
Problem DescriptionComputer simulations often require random numbers. One way to generate pseudo-random numbers is via a function of the formseed(x+1) = [seed(x) + STEP] % MODwhere '%' is
2014-10-18 10:06:28 428
原创 hdu 1037
Problem DescriptionBoudreaux and Thibodeaux are on the road again . . ."Boudreaux, we have to get this shipment of mudbugs to Baton Rouge by tonight!""Don't worry, Thibodeaux, I already ch
2014-10-15 17:49:23 424
原创 hdu 2106
Problem DescriptionAs we know , we always use the decimal system in our common life, even using the computer. If we want to calculate the value that 3 plus 9, we just import 3 and 9.after calculat
2014-10-13 18:09:17 464
原创 hdu 1228
Problem Description读入两个小于100的正整数A和B,计算A+B.需要注意的是:A和B的每一位数字由对应的英文单词给出. Input测试输入包含若干测试用例,每个测试用例占一行,格式为"A + B =",相邻两字符串有一个空格间隔.当A和B同时为0时输入结束,相应的结果不要输出. Output对每个测试
2014-10-12 20:03:52 525
原创 hdu 1865
Problem DescriptionYou will be given a string which only contains ‘1’; You can merge two adjacent ‘1’ to be ‘2’, or leave the ‘1’ there. Surly, you may get many different results. For example, giv
2014-10-12 19:50:02 561
原创 hdu 2524
Problem Description给你一个高为n ,宽为m列的网格,计算出这个网格中有多少个矩形,下图为高为2,宽为4的网格. Input第一行输入一个t, 表示有t组数据,然后每行输入n,m,分别表示网格的高和宽 ( n Output每行输出网格中有多少个矩形. Sample Input2
2014-10-12 19:47:51 304
原创 hdu 2101
Problem DescriptionEveryone know the story that how Newton discovered the Universal Gravitation. One day, Newton walked leisurely, suddenly, an apple hit his head. Then Newton discovered the Unive
2014-10-10 20:56:08 657
原创 hdu 2103
Problem DescriptionAs far as we known,there are so many people in this world,expecially in china.But many people like LJ always insist on that more people more power.And he often says he will burn
2014-10-10 20:49:27 883
原创 hud 1056 HangOver
Problem DescriptionHow far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be per
2014-10-02 17:01:22 306
ThinkPHP3.2.3完全开发手册
2016-11-22
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人