遞歸搜索 nyoj 325 nyoj 32
#include#include#includeusing namespace std;int n, r,ans[100];void dfs(int u,int
hdu 1233 還是暢通工程(prim||kruskal)
這個完完全全就是模板題目,沒有一點變化,就是單純的讓求最小生成樹代碼:(prim) #include#include#include#include#
Codeforces Round #259 (Div. 2) B. Little Pony and Sort by Shift
One day, Twilight Sparkle is interested in how to sort a sequence of integers a1
Codeforces 276E(樹狀數組)
題意:一棵樹有n個節點,1是根節點,根節點的子節點是單鏈,然後現在有兩種操作0 v x d表示距離節點v為d的節點權值都加x,操作1 v問v節點的權值,初始節點
HDOJ 5411 CRB and Puzzle 矩陣快速冪
直接構造矩陣,最上面一行加一排1.快速冪計算矩陣的m次方,統計第一行的和 CRB and PuzzleTime Limit: 2000/1
hdu 1061 Rightmost Digit
暴力解決不了問題,有規律可循, 只需看末尾數字即可, 末尾數字的 n 次方是有規律的#includeusing namespace std;int main()
zoj 2314 Reactor Cooling 有上下界的網絡最大流
輸出的時候發現不會對原來的矩陣排序,只好重新搞了一儲存邊的一維數組,然後排序。#includeusing namespace std;const int N=2
POJ 題目3237 Tree(Link Cut Tree邊權變相反數,求兩點最大值)
Tree Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 6131