原创 POJ 2226 Muddy Fields————最小點覆蓋

Rain has pummeled the cows' field, a rectangular grid of R rows and C columns (1 <= R <= 50, 1 <= C <= 50). While good

原创 POJ 3107 Godfather————樹形dp 求樹的重心

Last years Chicago was full of gangster fights and strange murders. The chief of the police got really tired of all the

原创 HDU 1520 Anniversary party————樹形dp 模板題

Problem Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The

原创 hdu 1518 square————DFS

Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? Input The first line

原创 HDU 1083 COURSES————匈牙利算法 + 判斷

Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to d

原创 HDU 1863 暢通工程 ———— 圖的最小生成樹(Kruskal)

省政府“暢通工程”的目標是使全省任何兩個村莊間都可以實現公路交通(但不一定有直接的公路相連,只要能間接通過公路可達即可)。經過調查評估,得到的統計表中列出了有可能建設公路的若干條道路的成本。現請你編寫程序,計算出全省暢通需要的最低成本。

原创 hdu 1045 Fire Net————二分圖匹配(匈牙利算法)

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,

原创 hdu 2444 The Accomodation of Students —— 判斷是否爲二分圖 + 二分圖匹配

There are a group of students. Some of them may know each other, while others don't. For example, A and B know each oth

原创 POJ 1274 The Perfect Stall————匈牙利算法(模板題)

Farmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due

原创 UVa 111 History Grading —— LCS簡單題

Background Many problems in Computer Science involve maximizing some measure according to constraints. Consider a hist

原创 HDU 1159 Common Subsequence————LCS(最長公共子序列)模板題

A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence

原创 hdu 1114 Piggy-Bank ———— 完全揹包+求最小解

Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income fo

原创 hdu 1087 Super Jumping! Jumping! Jumping!——LIS變形 尋找和最大的遞增子序列

Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good

原创 hdu1080 Human Gene Functions————LCS變形

It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply d

原创 HDU 1712 ACboy needs your help——分組揹包模板題

ACboy has N courses this term, and he plans to spend at most M days on study.Of course,the profit he will gain from di