原创 HDU2102 A計劃分別用BFS和DFS實現

** BFS ** //BFS #include<cstdio> #include<iostream> #include<queue> #include<cstring> using namespace std; int n, m

原创 UVA 10603Fill 劉汝佳代碼紫書代碼理解

#include<cstdio> #include<cstring> #include<queue> #include<iostream> using namespace std; struct Node { int v[3],

原创 C++中定義long long 類型變量該注意的問題

//首先先知道 int 和 long long 最大值各爲多少 printf("%d\n", INT_MAX); //輸出2147483647 printf("%lld\n", INT64_MAX);//輸出9223372036

原创 大整數類BigInteger (完善加減乘除)

#include<iostream> #include<vector> #include<string> #include<algorithm> using namespace std; struct BigInteger {

原创 Codeforces 510B (雙向DFS) 超簡潔快速 31ms 秒AC

題目鏈接 AC截圖 思路: 在圖中找到一個環即可,枚舉每個點,以該點分別爲起點和終點進行dfs,如果相遇且步數大於4,則成功找到 簡潔代碼 用vis 標記狀態 注意開始的點標爲3 起點開始搜的標爲1 終點開始搜的標爲2 #in

原创 HDU 1584 (DFS好題)

蜘蛛牌 HDU - 1584 蜘蛛牌是windows xp操作系統自帶的一款紙牌遊戲,遊戲規則是這樣的:只能將牌拖到比她大一的牌上面(A最小,K最大),如果拖動的牌上有按順序排好的牌時,那麼這些牌也跟着一起移動,遊戲的目的是將所有

原创 HDU1045 Fire Net DFS搜索 AC代碼

題目 Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n co

原创 UVa230圖書管理系統(小白盡力版)

#include<iostream> #include<map> #include<set> #include<vector> #include<algorithm> #include<cstring> #include<stri