原创 Common Subsequence POJ - 1458

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

原创 DFS

概念 DFS(Depth-First-Search)深度優先搜索算法。DFS一般用遞歸來實現,改變當層狀態不斷深入,直到找到答案或者已經可以知道這樣下去無法得到答案,再返回到上一個狀態(恢復該層狀態)繼續遞歸。保證每一個點(每一種可能性)

原创 BFS練習

  UVA 439 Knight move A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the

原创 貪心算法

貪心算法(又稱貪婪算法)是指,在對求解問題,總是做出在當前看來是最好的選擇。也就是說,不從整體最優上加以考慮,他所做出的是在某種意義上的局部最優解。 貪心算法不是對所有問題都能得到整體最優解,關鍵是貪心策略的選擇,選擇的貪心策略必須具備無

原创 Proud Merchants hdu3466 (動態規劃)

Proud Merchants Problem Description Recently, iSea went to an ancient country. For such a long time, it was the most we

原创 LIS

  Super Jumping! Jumping! Jumping!  題目鏈接:HDU - 1087  Nowadays, a kind of chess game called “Super Jumping! Jumping! Jum

原创 遞歸+記憶化搜索

邊界條件與遞歸方程是遞歸函數的兩個要素。 1)階乘函數 Int fac(int n) { If (n==0) return 1; Else return n*fac(n-1); } 這裏,第一句的if是邊界條件,第二句是遞歸方程。0的階乘

原创 快速篩法求素數

普通的線性篩法: #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define MAX 1000 // 範圍 using namesp

原创 Wireless Network POJ - 2236 (並查集)

An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with

原创 暢通工程續 HDU - 1874 (最短路)

  某省自從實行了很多年的暢通工程計劃後,終於修建了很多路。不過路多了也不好,每次要從一個城鎮到另一個城鎮時,都有許多種道路方案可以選擇,而某些方案要比另一些方案行走的距離要短很多。這讓行人很困擾。  現在,已知起點和終點,請你計算出要從

原创 Friend-Graph HDU - 6152 (暴力出奇跡)

It is well known that small groups are not conducive of the development of a team. Therefore, there shouldn’t be any sm

原创 計算機三級網絡技術 = =

  計算機三級網絡技術考過指南   原文鏈接:計算機三級網絡技術考過指南 目錄:  三級網絡技術考過指南前言(必讀)1.基礎準備 1.1 題庫 1.2 二進制轉換 1.3 基礎概念 1.4 備考建議 2.選擇題(40 道 40 分)

原创 Pinball HDU - 6373 (高中物理,我佛)

There is a slope on the 2D plane. The lowest point of the slope is at the origin. There is a small ball falling down ab

原创 A water problem HDU - 5832 (大位數取模)

Two planets named Haha and Xixi in the universe and they were created with the universe beginning.  There is 7373 days

原创 P1049 裝箱問題 dp or dfs

題目描述 有一個箱子容量爲 VVV (正整數, 0≤V≤200000 \le V \le 200000≤V≤20000 ),同時有 nnn 個物品( 0<n≤300<n \le 300<n≤30 ,每個物品有一個體積(正整數)。 要求