原创 poj3096——Surprising Strings(STL)

Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other

原创 Lightoj1047——Neighbor House(dp)

The people of Mohammadpur have decided to paint each of their houses red, green, or blue. They’ve also decided that

原创 poj1201——Intervals(差分約束)

Description You are given n closed, integer intervals [ai, bi] and n integers c1, …, cn. Write a program that:

原创 csu1779——錯誤的算法(模擬)

有道題目是這樣的: 輸入一個 n 行 m 列網格,找一個格子,使得它所在的行和列中所有格子的數之和最大。如果答 案不唯一,輸出任意解即可。比如,在下面的例子中,最優解是(1,3),即第一行和的三列的交 點(行從上到下編號爲 1~n

原创 hdu4549——M斐波那契數列(費馬小定理+矩陣快速冪)

Problem Description M斐波那契數列F[n]是一種整數數列,它的定義如下: F[0] = a F[1] = b F[n] = F[n-1] * F[n-2] ( n > 1 ) 現在給出a, b, n,你能

原创 HZAU1208——Color Circle(dfs)

Description There are colorful flowers in the parterre in front of the door of college and form many beautifu

原创 poj1088——滑雪(記憶化dp)

Description Michael喜歡滑雪百這並不奇怪, 因爲滑雪的確很刺激。可是爲了獲得速度,滑的區域必須向下傾斜,而且當你滑到坡底,你不得不再次走上坡或者等待升降機來載你。Michael想知道載一個區域中最長底滑坡。區域由

原创 poj2983——Is the Information Reliable?(差分約束+負權環路)

Description The galaxy war between the Empire Draco and the Commonwealth of Zibu broke out 3 years ago. Draco estab

原创 csu1781——階乘除法

Description 輸入兩個正整數 n, m,輸出 n!/m!,其中階乘定義爲 n!= 1*2*3*…*n (n>=1)。 比如,若 n=6, m=3,則 n!/m!=6!/3!=720/6=120。 是不是很簡單?現在讓我

原创 Lightoj1111——Best Picnic Ever(dfs)

K people are having a picnic. They are initially in N cities, conveniently numbered from 1 to N. The roads between

原创 Lightoj1238——Power Puff Girls(bfs)

The city of Townsville! This nice city is the home for the power puff girls - Blossom, Bubbles and Buttercup. To in

原创 csu1783——聊天止於呵呵(字符串)

Description (現代版)俗話說:流言止於智者,聊天止於呵呵。輸入一段聊天記錄,你的任務是數一數有 多少段對話“止於呵呵”,即對話的最後一句話包含單詞 hehe 或者它的變形。 具體來說,我們首先提取出對話的最後一句話,

原创 OpenGL應用——實現中點Bresenham算法

算法本體還是照搬書上的,既然已經能搞DDA了,這個就很輕鬆了 聲明:以下知識全部來源於互聯網,本人並不懂其中原理 #include <GL/gl.h> #include <GL/glut.h> #include <iostream

原创 Lightoj1112——Curious Robin Hood(線段樹+單點更新)

Robin Hood likes to loot rich people since he helps the poor people with this money. Instead of keeping all the mon

原创 csu1777——大還是小?(字符串處理?)

Description 輸入兩個實數,判斷第一個數大,第二個數大還是一樣大。每個數的格式爲: [整數部分].[小數部分] 簡單起見,整數部分和小數部分都保證非空,且整數部分不會有前導 0。不過,小數部分的最 後可以有 0,因