原创 poj 2698:八皇后問題

解題思路: DFS #include<iostream> #include<cstring> using namespace std; //地圖 struct map { int v[10][10]; int t[10][10];

原创 poj 3717: 移動路線

解題思路: 遞推,v[i][j] = v[i-1][j] + v[i][j-1] #include<iostream> using namespace std; int main() { int m,n; int v[25][25];

原创 poj 2942: 喫糖果

#include<iostream> using namespace std; int main() { int a[25]; a[1] = 1; a[2] = 2; int n; cin>>n; if(n==1) cou

原创 poj 1502: MPI Maelstrom

解題思路: (1)floyd算法求解單源最短路徑問題 (2)注意inf (1<<30) 相加時產生的int溢出的問題 #include<iostream> #include<cstring> #include<cstdlib> using

原创 poj 2362:Square

解題思路: DFS+剪枝 #include<iostream> #include<cstring> #include<cstdio> #include<cstdlib> using namespace std; int m,n,s; i

原创 poj 2488:A Knight's Journey

解題思路: DFS + 路徑保存 #include<iostream> #include<cstring> using namespace std; int m,r,c; int map[30][30]; //記錄方格是否被覆蓋 i

原创 poj 1258: Agri-Net

解題思路: prim算法求解最小生成樹 #include<iostream> #include<cstring> using namespace std; const int inf = 1<<30; int main() { i

原创 poj 3704:擴號匹配問題

#include<iostream> #include<cstring> using namespace std; int main() { char s[110]; int v[110]; while(cin.getline(s,

原创 poj 3714:點菜問題

#include<iostream> using namespace std; struct food { int p,v; }; int main() { int c,m; int dp[1010]; food f[110];

原创 poj 2806: 公共子序列

解題思路: 動態規劃 #include<iostream> #include<cstring> using namespace std; int main() { char a[205],b[205]; int v[205][205]

原创 poj 2531: Network Saboteur

解題思路: DFS #include<iostream> using namespace std; int n; int traff[25][25]; int group1[25],num1 = 0; int group2[25],nu

原创 poj 2754:八皇后

解題思路: DFS #include<iostream> #include<cstring> using namespace std; //地圖 struct map { int v[10][10]; int t[10][10];

原创 poj 3709: 2進制轉化爲3進制

#include<iostream> #include<cstring> using namespace std; int main() { int m; cin>>m; string bstring,tstring; while

原创 poj 1664:放蘋果

#include<iostream> using namespace std; int count(int x,int y) { if(x==1||y==1) return 1; else if(x>y) return cou

原创 網絡分層——OSI模型

ISO提出的OSI模型將網絡分爲七層:物理層、數據鏈路層、網絡層、傳輸層、會話層、表示層和應用層。 1至4層被認爲是低層,這些層與數據移動密切相關;5至7層是高層,包含應用程序級的數據。 每一層負責一項具體的工作,然後把數據傳送到下一層