07 2015 档案
摘要: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 ...
阅读全文
摘要:Bobo has a tree,whose vertices are conveniently labeled by 1,2,...,n.Each node has a weightwi. All the weights are distrinct.A set with m nodesv1,v2,....
阅读全文
摘要:Problem DescriptionMr. Hdu is an painter, as we all know, painters need ideas to innovate , one day, he got stuck in rut and the ideas dry up, he took...
阅读全文
摘要:Today, Soda has learned a sequence whosen-th(n≥1)item is3n(n−1)+1. Now he wants to know if an integermcan be represented as the sum of some items of t...
阅读全文
摘要:Today is the 1st anniversary of BestCoder. Soda, the contest manager, gets a stringsof lengthn. He wants to find three nonoverlapping substringss[l1.....
阅读全文
摘要:Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three de...
阅读全文
摘要:Farmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the ...
阅读全文
摘要:Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his informatics teacher is going to have a birthday and the beave...
阅读全文
摘要:Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing. Having returned to the castle, Twili...
阅读全文
摘要:There arenpeople andmpairs of friends. For every pair of friends, they can choose to become online friends (communicating using online applications) o...
阅读全文
摘要:Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to. Then he measured the length of ...
阅读全文
摘要:Today on a lecture about strings Gerald learned a new definition of string equivalency. Two stringsaandbof equal length are calledequivalentin one of ...
阅读全文
摘要:Amr loves Chemistry, and specially doing experiments. He is preparing for a new interesting experiment.Amr hasndifferent types of chemicals. Each chem...
阅读全文
摘要:roblem 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 abil...
阅读全文
摘要:Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.Initially you have a sequence ofn...
阅读全文
摘要:Mr. Kitayuta has just bought an undirected graph consisting ofnvertices andmedges. The vertices of the graph are numbered from 1 ton. Each edge, namel...
阅读全文
摘要:DescriptionTomash keeps wandering off and getting lost while he is walking along the streets of Berland. It's no surprise! In his home town, for any p...
阅读全文
摘要:DZY loves chemistry, and he enjoys mixing chemicals.DZY hasnchemicals, andmpairs of them will react. He wants to pour these chemicals into a test tube...
阅读全文
摘要:Problem DescriptionOO has got a array A of size n ,defined a function f(l,r) represent the number of i (li) satisfy aimod aj=0,now OO want to know∑i=1...
阅读全文
摘要:A colored stripe is represented by a horizontal row ofnsquare cells, each cell is pained one ofkcolors. Your task is to repaint the minimum number of ...
阅读全文
摘要:/*大意:给出m给不认识关系,要把他们分成两组,每组人都要认识用一个col来记录是否相邻,如果出现奇数环会使得col[v] != 3 - color,不能省如果不存在边,特判,分一个人过去*/#include #include #include #include using namespace st...
阅读全文
摘要:Young theoretical computer scientist wyh2000 is teaching young pupils some basic concepts about strings.A subsequence of a stringsis a string that can...
阅读全文
摘要:Vasya has a very beautiful country garden that can be represented as ann × mrectangular field divided inton·msquares. One beautiful day Vasya remember...
阅读全文
摘要:#include#include#include#include//greater 使得从小到大 ,less反//priority_queue, less > que 相当于 priority_queue que#includeusing namespace std;const int MAX =...
阅读全文
摘要:We'll defineS(n)for positive integernas follows: the number of then's digits in the decimal base. For example,S(893) = 3,S(114514) = 6.You want to mak...
阅读全文
摘要:lzs种了n棵树,每棵树每天长高一定的高度。某一天,lzs想知道树长得怎么样了,你能求出那一天最高的树有多高吗?Input有多组测试数据,每组数据第一行输入两个整数n,m(1#include#includeusing namespace std;const int MAX = 100000 + 10...
阅读全文
摘要:由于计划生育的实行,我们以及将来几代人都会是独生子女,即每对夫妇只会有一个孩子。那么给你XXXX年某人的一张树形族谱,你能指出其中任意两人的关系吗?Input输入数据第一行一个整数T表示有T组数据。每组数据第一行一个正整数N (2 #include#include#includeusing name...
阅读全文
摘要:Given an array of positive integers and m queries.Each query contains i, j, x, output the number of occurrences of x into the subarray Ai,Ai+1...,Aj.I...
阅读全文
摘要:Wangpeng has N clothes, M pants and K shoes so theoretically he can have N×M×K different combinations of dressing.One day he wears his pants Nike, sho...
阅读全文
摘要:Rabbit Tom and rabbit Jerry are running in a field. The field is an N×N grid. Tom starts from the up-left cell and Jerry starts from the down-right ce...
阅读全文
摘要:Imagine that you have to prepare a problem set for the forthcoming programming contest and you have already chosen the problems you will use in it. Be...
阅读全文
摘要:Side onePoll flew above the City. Bright street lights flashed by below. He was winding his way around needle-sharp spires of communication towers and...
阅读全文
摘要:DZY has a sequencea, consisting ofnintegers.We'll call a sequenceai, ai + 1, ..., aj(1 ≤ i ≤ j ≤ n)a subsegment of the sequencea. The value(j - i + 1)...
阅读全文
摘要:/*莫队算法是离线算法,用来解决已知l,r问你l,r里面值的问题对块进行排序,后面的块通过前面的块左移右移得到,所以可能有的情况能得到O(1)或者较低的复杂度排序的时候除以跟好n(?)本题题意:从l到r区间内问有多少个不同的数,询问很多*/#include#include#include#inclu...
阅读全文
摘要:DescriptionA tourist hiked along the mountain range. The hike lasted forndays, during each day the tourist noted height above the sea level. On thei-t...
阅读全文
摘要:There arenpiles of pebbles on the table, thei-th pile containsaipebbles. Your task is to paint each pebble using one of thekgiven colors so that for e...
阅读全文
摘要:Andrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhibition of contemporary art.The main exhibi...
阅读全文
摘要:You have a positive integermand a non-negative integers. Your task is to find the smallest and the largest of the numbers that have lengthmand sum of ...
阅读全文
摘要:Jeff's gotncards, each card contains either digit 0, or digit 5. Jeff can choose several cards and put them in a line so that he gets some number. Wha...
阅读全文
摘要:Math is very important, for those who are also in school, make sure you will learn more about math.Salmon and Cat are good friends.Today Salmon ask Ca...
阅读全文
摘要:Ytaaa作为一名特工执行了无数困难的任务,这一次ytaaa收到命令,需要炸毁敌人的一个工厂,为此ytaaa需要制造一批炸弹以供使用。 Ytaaa使用的这种新型炸弹由若干个炸药组成,每个炸药都有它的威力值,而炸弹的威力值为组成这个炸弹的所有炸药的最大威力差的平方,即(max-min)^2,假设一个炸...
阅读全文
摘要:Problem DescriptionThe description of this problem is very short. Now give you a string(length N), and ask you the max sum of the substring which the ...
阅读全文
摘要:DescriptionAlex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and de...
阅读全文
摘要:You are givennk-digit integers. You have to rearrange the digits in the integers so that the difference between the largest and the smallest number wa...
阅读全文
摘要:/* map 向量可以存东西与数的大小无关,只与数的数目有关 */#include#include#include#includeusing namespace std;mapa;int main(){ for(int i = 0; i <= 32000; i++){ a[...
阅读全文
摘要:Right turnfrog is trapped in a maze. The maze is infinitely large and divided into grids. It also consists ofnobstacles, where thei-th obstacle lies i...
阅读全文
摘要:ProblemA Communist regime is trying to redistribute wealth in a village. They have have decided to sit everyone around a circular table. First, everyo...
阅读全文