原创 SZ斐波拉契數列

Problem Description Fibonacci sequence is familiar to you, right? Here comes the SZ Fibonacci sequence, with the proper

原创 一元三次方程求解(二分法尋根)

Problem Description 有形如:ax^3+bx^2+cx+d=0這樣的一個一元三次方程。給出該方程中各項的係數(a,b,c,d均爲實數),並約定該方程存在三個不同實根(根的範圍在-100至100之間),且根與根之差的絕對值

原创 Single Round Match

#include<cstdio> #include<cstring> #include<iostream> using namespace std; int main() { int t,x; cin>>t; wh

原创 01揹包問題

Problem Description 一個旅行者有一個最多能裝M公斤的揹包,現在有n件物品,它們的重量分別是W1,W2,...,Wn,它們的價值分別爲C1,C2,...Cn,求旅行者能獲得最大總價值。 Input 輸入有多組數據,對於

原创 過河卒

Problem Description 棋盤上A點有一個過河卒,需要走到目標B點。卒行走的規則:可以向下、或者向右。同時在棋盤上的任一點有一個對方的馬(如C點),該馬所在的點和所有跳躍一步可達的點稱爲對方馬的控制點(馬走日字),卒不

原创 馬的走法

Problem Description 在一個4×5的棋盤上,求馬能返回初始位置的所有不同走法的總數(馬走過的位置不能重複,馬走“日”字)。 Input 從輸入文件中讀入數據。文件的第一行馬的初始位置的個數n,後面n行是初始位置座標。

原创 數塔

Problem Description 在講述DP算法的時候,一個經典的例子就是數塔問題,它是這樣描述的: 有如下所示的數塔,要求從頂層走到底層,若每一步只能走到相鄰的結點,則經過的結點的數字之和最大是多少? 已經告訴你了,這是個DP的題

原创 兔子

Problem Description The rabbits have powerful reproduction ability. One pair of adult rabbits can give birth to one pai

原创 排序算法

Problem Description One of the fundamental problems of computer science is ordering a list of items. There're a plethor

原创 Yu Ji

Problem Description Yu Ji is very annoying because he always ask others to guess his boring riddles. He will find diff

原创 cover

<span style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: rgb(255, 255, 255);">Problem

原创 最長上升子序列

Problem Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric

原创 大數模板

Sample Input 2 1 2 112233445566778899 998877665544332211 Sample Output Case 1: 1 + 2 = 3   Case 2: 112233445566778899 +

原创 Red and Black

Problem Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black.

原创 刪數問題

Problem Description 輸入一個高精度的正整數N,去掉其中任意S個數字後剩下的數字按原左右次序組成一個新的正整數。編程對給定的N和S,尋找一種方案使得剩下的數字組成的新數最小。 輸出新的正整數。(N不超過240位)輸入數據