- 博客(71)
- 收藏
- 关注
转载 2015 Multi-University Training Contest 5 1009 模板
比赛链接:click here~~hdu 5344 MZL's xor【题意】:Problem DescriptionMZL loves xor very much.Now he gets an array A.The length of A is n.He wants to know the xor of all (Ai+Aj)(1≤i,j≤n)Th
2015-08-08 16:11:17
423
原创 Assignment
Problem DescriptionTom owns a company and he is the boss. There are n staffs which are numbered from 1 to n in this company, and every staff has a ability. Now, Tom is going to assign a special task
2015-07-22 20:18:26
496
原创 RMQ——ST算法
RMQ(Range Minimum/Maximum Query)问题是区间最值问题。如果用线段树,预处理和查询的复杂度都是O(logn)。而ST算法,可以做到O(nlogn)的预处理,O(1)地回答每个询问ST算法实现(以最大值为例): 首先是预处理,用DP解决。设a[i]是要求区间最值的数列,f[i,j]表示从第i个数起连续2^j个数中的最大值。可以看出f[i,0]其实就等于a[i]。
2015-07-22 20:09:13
405
原创 OO’s Sequence
Problem Description OO has got a array A of size n ,defined a function f(l,r) represent the number of i (li) satisfy ai mod aj=0,now OO want to know ∑i=1n∑j=inf(i,j) mod (109+7).
2015-07-21 21:19:13
1024
原创 Fractions Again?!(暴力)
Problem A: Fractions Again?!Time limit: 1 secondIt is easy to see that for every fraction in the form (k > 0), we can always find two positive integers x and y, x ≥ y, such
2014-10-26 20:22:46
742
原创 Maximum Product(暴力)
DescriptionAC Problem D - Maximum ProductTime Limit: 1 secondGiven a sequence of integers S = {S1, S2, ..., Sn}, you should determine what is the value of the maximum positive product
2014-10-26 20:20:30
508
原创 Drainage Ditches(网络流_EK模板)
Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regrow. Thus, Fa
2014-08-20 20:49:54
492
原创 Closest Common Ancestors(LCA)
DescriptionWrite a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the closest common ancestor of u and v in the tree. The c
2014-08-19 15:24:15
602
原创 JAVA 与CPP的词法分析
首先不要被题目吓倒,本题只是要求写一个JAVA与CPP程序变量名的转换程序。 JAVA 的变量形式如下:以小写字母开头,然后紧跟0个或多个首字母大写的单词组成,比如:javaIdentifierlongAndMnemonicIdentifiernameopenSolaris CPP 的变量形式如下:全部由小写字母和分隔符'_' 组成 ,单词之间由一个‘_’ 连接而成
2014-08-18 20:24:42
726
原创 Oil Skimming(二分图)
DescriptionThanks to a certain "green" resources company, there is a new profitable industry of oil skimming. There are large slicks of crude oil floating in the Gulf of Mexico just waiting to be
2014-08-16 16:20:57
557
原创 Kindergarten(二分图)
DescriptionIn a kindergarten, there are a lot of kids. All girls of the kids know each other and all boys also know each other. In addition to that, some girls and boys know each other. Now the te
2014-08-16 11:16:44
544
原创 50 years, 50 colors(二分图)
DescriptionOn Octorber 21st, HDU 50-year-celebration, 50-color balloons floating around the campus, it's so nice, isn't it? To celebrate this meaningful day, the ACM team of HDU hold some fuuny ga
2014-08-16 10:39:00
445
转载 二分图趣写(二分图)
【书本上的算法往往讲得非常复杂,我和我的朋友计划用一些简单通俗的例子来描述算法的流程】匈牙利算法是由匈牙利数学家Edmonds于1965年提出,因而得名。匈牙利算法是基于Hall定理中充分性证明的思想,它是部图匹配最常见的算法,该算法的核心就是寻找增广路径,它是一种用增广路径求二分图最大匹配的算法。-------等等,看得头大?那么请看下面的版本:通
2014-08-15 21:20:53
410
原创 棋盘游戏(二分图)
Description小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互相攻击。 所以现在Gardon想让小希来解决一个更难的问题,在保证尽量多的“车”的前提下,棋盘里有些格子是可以避开的
2014-08-15 20:58:51
633
转载 二分图匹配算法总结
二分图匹配算法总结 二分图最大匹配的匈牙利算法 二分图是这样一个图,它的顶点可以分类两个集合X和Y,所有的边关联在两个顶点中,恰好一个属于集合X,另一个属于集合Y。 最大匹配:图中包含边数最多的匹配称为图的最大匹配。 完美匹配:如果所有点都在匹配边上,称这个最大匹配是完美匹配。 最小覆盖: 最小覆盖要求用最少的点(X集合或Y集合的都行)让每条边都至少和其中一个点关联。可以证明:最少的点(即覆盖
2014-08-14 21:49:41
606
原创 Coder(线段树)
Description In mathematics and computer science, an algorithm describes a set of procedures or instructions that define a procedure. The term has become increasing popular since the advent of che
2014-08-14 20:11:00
444
原创 Billboard(线段树)
DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcements are po
2014-08-14 20:07:58
405
原创 I Hate It(线段树)
Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和
2014-08-14 20:05:42
445
原创 Mayor's posters(线段树+离散化+着色)
DescriptionThe 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 coun
2014-08-14 19:21:32
404
原创 Crane(线段树)
DescriptionACM has bought a new crane (crane -- jeřáb) . The crane consists of n segments of various lengths, connected by flexible joints. The end of the i-th segment is joined to the beginning
2014-08-14 16:59:17
549
原创 Panda(线段树 )
DescriptionWhen I wrote down this letter, you may have been on the airplane to U.S. We have known for 15 years, which has exceeded one-fifth of my whole life. I still remember the first time we
2014-08-13 15:10:26
647
原创 A Simple Problem with Integers(线段树)
DescriptionYou 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 each number in a given interval. The other i
2014-08-12 16:24:25
524
原创 Minimum Inversion Number(线段树)
DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj. For a given sequence of numbers a1, a2, ..., an, if we move the f
2014-08-11 22:09:27
583
原创 Word Puzzles(字典树)
DescriptionWord puzzles are usually simple and very entertaining for all ages. They are so entertaining that Pizza-Hut company started using table covers with word puzzles printed on them, possi
2014-08-11 17:26:34
1129
原创 Shortest Prefixes(字典树)
DescriptionA prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c", "ca", "car", "carb", "carbo", and "carbon". Note that the empty s
2014-08-11 17:02:02
438
原创 敌兵布阵(线段树)
DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报
2014-08-09 22:18:44
438
原创 IMMEDIATE DECODABILITY(字典树)
DescriptionAn encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for another symbol. We will assume for this problem that all code
2014-08-09 15:50:26
519
原创 Phone List(字典树,数据结构)
DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers:1. Emergency 911
2014-08-08 18:55:23
795
原创 统计难题(字典树)
DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分
2014-08-08 10:02:15
665
原创 Prime Distance(数论)
DescriptionThe branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the qu
2014-08-07 15:50:21
600
原创 Biorhythms(数论)
DescriptionSome people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and t
2014-08-06 19:29:06
460
原创 Heavy Cargo(数论)
DescriptionBig Johnsson Trucks Inc. is a company specialized in manufacturing big trucks. Their latest model, the Godzilla V12, is so big that the amount of cargo you can transport with it is ne
2014-08-06 14:39:50
641
原创 A/B(数论)
Description要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。 Input数据的第一行是一个T,表示有T组数据。每组数据有两个数n(0 Output对应每组数据输出(A/B)%9973。 Sample
2014-08-06 10:42:58
653
原创 Goldbach's Conjecture(数论)
DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture: Every even number greater than 4 can be wri
2014-08-05 21:45:26
417
原创 The Balance(数论)
DescriptionMs. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine. For example, to measure 200mg of aspirin using 300mg weights and 700mg weights, she
2014-08-05 20:47:14
481
原创 Wolf and Rabbit
DescriptionThere is a hill with n holes around. The holes are signed from 0 to n-1.A rabbit must hide in one of the holes. A wolf searches the rabbit in anticlockwise order. The first ho
2014-08-05 15:33:18
530
原创 青蛙的约会(数论)
Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能
2014-08-05 11:24:31
556
原创 NUMBER BASE CONVERSION(高精度)
DescriptionWrite a program to convert numbers in one base to numbers in a second base. There are 62 different digits: { 0-9,A-Z,a-z } HINT: If you make a sequence of base conversions using t
2014-08-04 20:33:35
721
原创 Exponentiation(高精度)
DescriptionProblems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many
2014-08-04 20:09:45
374
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人