原创 博弈論經典問題Nim問題

  博弈論經典問題,Nim遊戲是一個典型的組合遊戲問題,很多遊戲問題都可以規約到Nim遊戲問題。Nim遊戲問題是一個ICG(Impartial Combinatorial Games)問題; ICG問題的特徵是: 1.兩個人蔘與,交替走棋

原创 PKU 1477 Box of Bricks

Box of Bricks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9698 Accepted: 4233 Description Little

原创 next_permutation解決排列問題的利器

今天看到了STL中的next_permutation函數,其功能之強大令人拜倒,next_permutation的功能是在全排列中查找下一個排列,函數原型及源碼就不說了,這裏舉一個應用的例子 排列 Time Limit: 1000MS

原创 kruskal算法

Dark roads Time Limit: 2000ms, Special Time Limit: 5000ms, Memory Limit: 65536KB Total submit users: 15, Accepted

原创 PKU 2521 How much did the businessman lose這道題太水了………………

How much did the businessman lose Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7880 Accepted: 5272

原创 PKU 1936 All in All

All in All Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 16864 Accepted: 6633 Description You hav

原创 優先隊列三題

      優先隊列是一種十分強大的數據結構,它保持了一種動態的有序性,對於不斷改變有入隊的操作,而又需要某種最大或最小的操作的問題是再合適不過了,通常優先隊列的實現是由最小堆或者最大堆完成的,並通過堆排序保持隊列的有序性,模擬隊列的結構

原创 PKU 3176 Cow Bowling

Cow Bowling Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7037 Accepted: 4582 Description The cow

原创 PKU 3210 Coins

n個硬幣 如果是偶數的話:肯定可以分成兩個奇數相加,這樣翻的話肯定會翻奇數次;也肯定可以分成兩個偶數相加,這樣翻的話就肯定是偶數次;這樣就 肯定沒有一個值同時滿足的;所以偶數就不成立; 如果是奇數的話:就肯定是分成一個奇數和一個偶數相加;

原创 PKU 1007 DNA Sorting

DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 47618 Accepted: 18598 Description One m

原创 PKU 1504 Adding Reversed Numbers

Adding Reversed Numbers Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9491 Accepted: 5250 Descript

原创 我的進度

代碼能力:50+; 動態規劃: 數位dp:HDOJ 3555 bomb 簡單數位dp:http://acm.hdu.edu.cn/showproblem.php?pid=3555 dp中的雙向問題:2 編輯距離:1; LIS類問題;2;

原创 位運算

統計1的個數 int count(int x) {     int res=0;     while(x){         res++;         x&=x-1;     }     return res; }

原创 完全揹包 poj 2063 Investment

#include <iostream> #include <cstdio> #include <cstring> using namespace std; int c[20]; int I[20]; int dp[50050]; int

原创 旋轉卡殼

http://www.cppblog.com/staryjy/archive/2010/09/25/101412.html