![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
acm训练
文章平均质量分 63
洋-葱
无所畏惧
展开
-
【A + B Problem II 】【HDU - 1002 】(高精度加法)
题目: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...原创 2019-06-12 17:10:05 · 279 阅读 · 0 评论 -
【Fire Net 】【HDU - 1045】(最大匹配—匈牙利算法)
题目:Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small cast...原创 2018-11-15 22:36:57 · 241 阅读 · 0 评论 -
【二分匹配-匈牙利算法】
转自奆佬的博客:https://blog.csdn.net/dark_scope/article/details/8880547匈牙利算法是由匈牙利数学家Edmonds于1965年提出,因而得名。匈牙利算法是基于Hall定理中充分性证明的思想,它是部图匹配最常见的算法,该算法的核心就是寻找增广路径,它是一种用增广路径求二分图最大匹配的算法。-------等等,看得头大?那么请看下面的版本:...转载 2018-11-16 16:49:56 · 187 阅读 · 0 评论 -
【过山车】【HDU - 2063】(二分最大匹配—匈牙利算法)
题目:RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,PrincessSnow愿意和水域浪子或伪酷儿做partn...原创 2018-11-15 21:49:41 · 137 阅读 · 0 评论 -
【Choosing Capital for Treeland 】【CodeForces - 219D 】(树形dp)
题目:The country Treeland consists of n cities, some pairs of them are connected with unidirectional roads. Overall there are n - 1 roads in the country. We know that if we don't take the direction of...原创 2018-11-17 13:45:23 · 251 阅读 · 0 评论 -
【Average distance】【HDU - 2376 】(树形dp)
题目:Given a tree, calculate the average distance between two vertices in the tree. For example, the average distance between two vertices in the following tree is (d 01 + d 02 + d 03 + d 04 + d 12 +d...原创 2018-11-14 22:10:39 · 195 阅读 · 0 评论 -
【大数加法】【51Nod - 1005】(大数加法)
题目:给出2个大整数A,B,计算A+B的结果。Input第1行:大数A 第2行:大数B (A,B的长度 <= 10000 需注意:A B有可能为负数)Output输出A + BSample Input68932147586468711654886Sample Output537643802472 #include<stdio...原创 2018-11-04 17:33:18 · 198 阅读 · 0 评论 -
【大数乘法】【51Nod - 1027】(大数乘法)
题目:给出2个大整数A,B,计算A*B的结果。Input第1行:大数A 第2行:大数B (A,B的长度 <= 1000,A,B >= 0)Output输出A * BSample Input123456234567Sample Output28958703552解题报告:大数乘法,利用数组进行模拟。ac代码:#include&...原创 2018-11-04 17:40:56 · 180 阅读 · 0 评论 -
【Planets】【CodeForces - 230D】(spfa+二分)
题目:Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis l...原创 2018-12-18 16:51:25 · 1091 阅读 · 0 评论 -
【Roads in the North】【POJ - 2631】(树的直径)
题目:Building and maintaining roads among communities in the far North is an expensive business. With this in mind, the roads are build such that there is only one route from a village to a village th...原创 2018-11-23 14:16:00 · 145 阅读 · 0 评论 -
【CodeForces - 227A】【 Where do I Turn? 】
题目:Trouble came from the overseas lands: a three-headed dragon Gorynych arrived. The dragon settled at point C and began to terrorize the residents of the surrounding villages.A brave hero decided...原创 2018-11-02 21:49:54 · 215 阅读 · 0 评论 -
【 HDU Today 】【HDU - 2112】(dijkstra+map)
题目:经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬浦镇陶姚村买了个房子,开始安度晚年了。 这样住了一段时间,徐总对当地的交通还是不太了解。有时很郁闷,想去一个地方又不知道应该乘什么公交车,在什么地方转车,在什么地方下车(其实徐总自己有车,...原创 2018-11-18 12:59:17 · 111 阅读 · 0 评论 -
【Jungle Roads】【POJ - 1251】(最小生成树)
题目:The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentle...原创 2018-11-05 23:40:04 · 111 阅读 · 0 评论 -
【Asteroids 】【POJ - 3041】(网络流-二分匹配-匈牙利)(思维)
题目:Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids (1 <= K <= 10,000), which are co...原创 2018-11-24 19:21:33 · 185 阅读 · 0 评论 -
【Skiing】【POJ - 3037】(dijkstra+堆优化)
题目:Bessie and the rest of Farmer John's cows are taking a trip this winter to go skiing. One day Bessie finds herself at the top left corner of an R (1 <= R <= 100) by C (1 <= C <= 100) ...原创 2018-11-05 23:35:19 · 306 阅读 · 0 评论 -
【MPI Maelstrom】【POJ - 1502】(dijkstra+邻接矩阵)
题目:BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine McKee's research...原创 2018-11-05 23:03:38 · 124 阅读 · 0 评论 -
【Power Network】【POJ - 1459】(网络流-最大流)
题目:A power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied with an amount s(u) >= 0 of power, may produce an amo...原创 2018-11-24 18:40:47 · 182 阅读 · 0 评论 -
【Roadblocks】【POJ - 3255】(次短路)(模板裸题)
题目:Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, because she likes the scenery along the way...原创 2018-12-20 22:15:44 · 248 阅读 · 0 评论 -
【Til the Cows Come Home】【POJ - 2387】(dijkstra最短路)
题目:Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to ...原创 2018-11-01 22:18:38 · 120 阅读 · 0 评论 -
【迷宫游戏】【51Nod - 1459】(dijkstra)
题目:你来到一个迷宫前。该迷宫由若干个房间组成,每个房间都有一个得分,第一次进入这个房间,你就可以得到这个分数。还有若干双向道路连结这些房间,你沿着这些道路从一个房间走到另外一个房间需要一些时间。游戏规定了你的起点和终点房间,你首要目标是从起点尽快到达终点,在满足首要目标的前提下,使得你的得分总和尽可能大。现在问题来了,给定房间、道路、分数、起点和终点等全部信息,你能计算在尽快离开迷宫的前提下...原创 2018-11-18 12:32:45 · 149 阅读 · 0 评论 -
【51Nod - 1117】【聪明的木匠 】
题目: 一位老木匠需要将一根长的木棒切成N段。每段的长度分别为L1,L2,......,LN(1 <= L1,L2,…,LN <= 1000,且均为整数)个长度单位。我们认为切割时仅在整数点处切且没有木材损失。木匠发现,每一次切割花费的体力与该木棒的长度成正比,不妨设切割长度为1的木棒花费1单位体力。例如:若N=3,L1 = 3,L2 = 4,L3 = 5,则木棒原长为12,...原创 2018-10-22 19:04:44 · 149 阅读 · 0 评论 -
【Amr and Pins】【CodeForces - 507B 】(思维+贪心)
题目:Amr loves Geometry. One day he came up with a very interesting problem.Amr has a circle of radius r and center in point (x, y). He wants the circle center to be in new position (x', y').In on...原创 2018-12-21 22:08:53 · 175 阅读 · 0 评论 -
【Data Structure? 】【HDU - 4217】(线段树入门)
题目:Data structure is one of the basic skills for Computer Science students, which is a particular way of storing and organizing data in a computer so that it can be used efficiently. Today let me in...原创 2018-12-22 23:35:48 · 140 阅读 · 0 评论 -
【51Nod - 1672】【区间交】
题目:小A有一个含有n个非负整数的数列与m个区间,每个区间可以表示为li,ri。它想选择其中k个区间, 使得这些区间的交的那些位置所对应的数的和最大。(是指k个区间共同的交,即每个区间都包含这一段,具体可以参照样例) 在样例中,5个位置对应的值分别为1,2,3,4,6,那么选择2,5与4,5两个区间的区间交为4,5,它的值的和为10。Input第一行三个数n,k,m(1&l...原创 2018-10-29 09:32:35 · 192 阅读 · 0 评论 -
【CodeForces - 689C】【Mike and Chocolate Thieves 】(二分)
题目:Bad news came to Mike's village, some thieves stole a bunch of chocolates from the local factory! Horrible!Aside from loving sweet things, thieves from this area are known to be very greedy. So...原创 2018-10-26 17:35:37 · 130 阅读 · 0 评论 -
【HDU - 1937 】【Finding Seats 】
题目:A group of K friends is going to see a movie. However, they are too late to get good tickets, so they are looking for a good way to sit all nearby. Since they are all science students, they decid...原创 2018-08-26 10:16:34 · 178 阅读 · 0 评论 -
【HDU - 2899 】【Strange fuction】
题目:Now, here is a fuction: F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100) Can you find the minimum value when x is between 0 and 100.InputThe first line of the input contains an i...原创 2018-08-26 09:26:47 · 112 阅读 · 0 评论 -
【HDU - 3714】【Error Curves】
题目:Josephina is a clever girl and addicted to Machine Learning recently. She pays much attention to a method called Linear Discriminant Analysis, which has many interesting properties. In order t...原创 2018-08-26 09:41:31 · 162 阅读 · 0 评论 -
【The Moving Points】【HDU - 4717】(三分plus)
题目:There are N points in total. Every point moves in certain direction and certain speed. We want to know at what time that the largest distance between any two points would be minimum. And also, we...原创 2018-12-20 21:01:47 · 204 阅读 · 0 评论 -
【HDU - 4990】【Reading comprehension】
题目:Read the program below carefully then answer the question. #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include<iostream> #include <cstring> #...原创 2018-08-25 21:21:36 · 212 阅读 · 0 评论 -
【Paths on a Grid】【POJ - 1942 】(高精度组合数)
题目:Imagine you are attending your math lesson at school. Once again, you are bored because your teacher tells things that you already mastered years ago (this time he's explaining that (a+b) 2=a 2+2...原创 2018-11-07 12:35:03 · 316 阅读 · 1 评论 -
博弈论合集(博弈)
说到博弈论,他的官方解释就是:博弈论考虑游戏中的个体的预测行为和实际行为,并研究它们的优化策略。博弈论很多种类,一般训练中会遇到的有几种,巴什博弈,威佐夫博弈,尼姆博弈,斐波那契博弈。下面分开进行对这几种博弈来进行介绍。一。巴什博弈。(同余理论)巴什博奕:只有一堆n个物品,两个人轮流从中取物,规定每次最少取一个,最多取m个,最后取光者为胜。核心代码: if(n%(m+...原创 2018-11-21 21:54:05 · 3613 阅读 · 0 评论 -
【Matrix Power Series】【POJ - 3233 】(等比矩阵+矩阵乘法)
题目:Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak.InputThe input contains exactly one test case. The first line of input contains three positive integers ...原创 2018-11-23 15:00:52 · 167 阅读 · 0 评论 -
【ZOJ - 2836】【Number Puzzle】(容斥定理)
题目:Given a list of integers (A1, A2, ..., An), and a positive integer M, please find the number of positive integers that are not greater than M and dividable by any integer from the given list. ...原创 2018-10-30 21:10:45 · 261 阅读 · 0 评论 -
【CodeForces - 948B】【Primal Sport 】
题目:Alice and Bob begin their day with a quick game. They first choose a starting number X0 ≥ 3 and try to reach one million by the process described below.Alice goes first and then they take alter...原创 2018-08-23 14:26:51 · 190 阅读 · 0 评论 -
【HDU - 5685】【Problem A】
题目:度熊手上有一本字典存储了大量的单词,有一次,他把所有单词组成了一个很长很长的字符串。现在麻烦来了,他忘记了原来的字符串都是什么,神奇的是他竟然记得原来那些字符串的哈希值。一个字符串的哈希值,由以下公式计算得到: H(s)=∏i≤len(s)i=1(Si−28) (mod 9973)H(s)=∏i=1i≤len(s)(Si−28) (mod 9973) SiSi代表 S[i] 字符的 ...原创 2018-08-25 20:26:59 · 927 阅读 · 0 评论 -
【LightOJ - 102】【Trailing Zeroes (I) 】
题目:We know what a base of a number is and what the properties are. For example, we use decimal number system, where the base is 10 and we use the symbols - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}. But in dif...原创 2018-08-25 19:40:30 · 152 阅读 · 0 评论 -
【HDU - 1220】【Cube】
题目:Cowl is good at solving math problems. One day a friend asked him such a question: You are given a cube whose edge length is N, it is cut by the planes that was paralleled to its side planes into...原创 2018-11-02 21:44:29 · 157 阅读 · 0 评论 -
【HDU - 1576 】【A/B】
题目:要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。Input数据的第一行是一个T,表示有T组数据。 每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。Output对应每组数据输出(A/B)%9973。Sample Inpu...原创 2018-08-25 20:13:56 · 157 阅读 · 0 评论 -
【CodeForces - 215B】【Olympic Medal】(数学公式推导)
题目:The World Programming Olympics Medal is a metal disk, consisting of two parts: the first part is a ring with outer radius of r1 cm, inner radius of r2 cm, (0 < r2 < r1)made of metal with de...原创 2018-10-30 21:49:20 · 205 阅读 · 0 评论