HDU 5172 GTY's gay friends (線段樹)
題目地址:HDU 5172 比賽的時候用一個維護了區間和,區間積,區間最值的線段樹水過去了。。賽後數據改回10^6後,就TLE了。。 正解是區間和
POJ 1041 John's trip (歐拉回路)
題目地址:POJ 1041 題目要求是字典序,所以要先對邊號進行排序,使得每次總是先遍歷到邊號較小的點。用vector比較方便。 代碼如下: #include
LeetCode70——Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top. Each time
LeetCode28——Implement strStr()
Implement strStr(). Returns the index of the first occurrence of needle in hay
[LeetCode]Surrounded Regions
Given a 2D board containing X and O, capture all regions surrounded by X. A
C++標准 bind函數用法與C#簡單實現
在看C++標准程序庫書中,看到bind1st,bind2nd及bind的用法,當時就有一種熟悉感,仔細想了下,是F#裡提到的柯裡化。下面是維基百科的解釋:在計算
[LeetCode]Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list shoul
HDU 4085 Peach Blossom Spring 記憶化搜索枚舉子集 斯坦納樹
題目鏈接:點擊打開鏈接 題意: 第一行輸入n個點 m條可修建的無向邊 k個人 下面給出修建的邊和修建該邊的花費。 開始時k個人在1-k的每個點上(一個點各一人)