原创 POJ2632--Crashing Robots(模擬)

Description In a modernized warehouse, robots are used to fetch the goods. Careful planning is needed to ensure th

原创 POJ1740--A New Stone Game(Nin變形)

Do more with less Discussion Alice and Bob decide to play a new stone game.At the beginning of the game they pick

原创 POJ3349--Snowflake Snow Snowflakes(哈希)

Do more with less Description You may have heard that no two snowflakes are alike. Your task is to write a program

原创 POJ2406--Power Strings(KMP變形)

Do more with less Description Given two strings a and b we define a*b to be their concatenation. For example, if a

原创 UAa11582--Colossal Fibonacci Numbers!(快速冪)

Do more with less Discussion The i’th Fibonacci number f(i) is recursively defined in the following way:

原创 HDU4857--逃生(反向拓撲)

Problem Description 糟糕的事情發生啦,現在大家都忙着逃命。但是逃命的通道很窄,大家只能排成一行。 現在有n個人,從1標號到n。同時有一些奇怪的約束條件,每個都形如:a必須在b之前。 同時,社會是不

原创 POJ3295--Tautology(模擬)

Description WFF ‘N PROOF is a logic game played with dice. Each die has six faces representing some subset of the

原创 POJ3259--Wormholes(SPFA)

Do more with less Description While exploring his many farms, Farmer John has discovered a number of amazing wormh

原创 POJ1753--Flip Game(枚舉)

Do more with less Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each

原创 HDU1257--最小攔截系統(貪心)

Problem Description 某國爲了防禦敵國的導彈襲擊,發展出一種導彈攔截系統.但是這種導彈攔截系統有一個缺陷:雖然它的第一發炮彈能夠到達任意的高度,但是以後每一發炮彈都不能超過前一發的高度.某天,雷達捕捉到敵國的導

原创 POJ2975--Nin(Nin博弈)

Do more with less Discussion Nim is a 2-player game featuring several piles of stones. Players alternate turns, an

原创 POJ1067--取石子游戲(威佐夫博弈)

Do more with less Discussion 有兩堆石子,數量任意,可以不同。遊戲開始由兩個人輪流取石子。遊戲規定,每次有兩種不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在兩堆中同時取走相同數量的石子

原创 數論模板

Do more with less 歐幾里德算法(輾轉相除法) int gcd(int a, int b) { return b == 0 ? a : gcd(b, a%b); } 唯一分解定理 int judge(in

原创 一些自己不會的小函數用法

1 轉換和檢查 在頭文件ctype.h 中 1大小寫轉換 char ch; ch = toupper('a'); // ch 就爲 A char ch; ch = tolower('A'); // ch 就爲 a 2檢查是否

原创 HDU2188--選拔志願者(巴什博弈)

Do more with less Description 對於四川同胞遭受的災難,全國人民紛紛伸出援助之手,幾乎每個省市都派出了大量的救援人員,這其中包括搶險救災的武警部隊,治療和防疫的醫護人員,以及進行心理疏導的心理學專家。