原创 hdu 1425 整理下水題 排序

Problem Description給你n個整數,請按從大到小的順序輸出其中前m大的數。  Input每組測試數據有兩行,第一行有兩個數n,m(0<n,m<1000000),第二行包含n個各不相同,且都處於區間[-500000,5000

原创 UVA 679 Drop 完全二叉樹

對於一個結點k,其左子結點、右子結點的編號分別是2k和2k+1 A number of K balls are dropped one by one from the root of a fully binary tree struct

原创 UVA 514 Rails 棧

Description There is a famous railway station in PopPush City. Country there is incredibly hilly. The station w

原创 hdu 2013 整理下水題 遞推動規

Problem Description 喜歡西遊記的同學肯定都知道悟空偷喫蟠桃的故事,你們一定都覺得這猴子太鬧騰了,其實你們是有所不知:悟空是在研究一個數學問題! 什麼問題?他研究的問題是蟠桃一共有多少個! 不過,到最後,他還是沒能解

原创 hdu 1785 整理下水題 排序

Problem Description 本次集訓隊共有30多人蔘加,毫無疑問,你們都是很優秀的,但是由於參賽名額有限,只能選拔部分隊員參加省賽。從學校的角度,總是希望選拔出最優秀的18人組成6支隊伍來代表學校。但是,大家也知道,要想做

原创 UVA 572 Oil Deposits dfs求連通塊

The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with o

原创 hdu 2084 整理下水題 遞推動規

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

原创 hdu 1711 整理下水題

Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M

原创 hdu 1106 整理下水題 排序

Problem Description 輸入一行數字,如果我們把這行數字中的‘5’都看成空格,那麼就得到一行用空格分割的若干非負整數(可能有些整數以‘0’開頭,這些頭部的‘0’應該被忽略掉,除非這個整數就是由若干個‘0’組成的,這時這

原创 hdu 2020 整理下水題 排序

Problem Description 輸入n(n<=100)個整數,按照絕對值從大到小排序後輸出。題目保證對於每一個測試實例,所有的數的絕對值都不相等。   Input 輸入數據有多組,每組佔一行,每行的第一個數字爲n,接着是

原创 UVA 10791 Minimum Sum LCM

貼不上題目  直接上代碼 #include<iostream> using namespace std; int main() { int t=0; long long n; while(cin>>n)

原创 UVA 11582 - Colossal Fibonacci Numbers!

不知道怎麼搞的  題目粘不上來了 直接上代碼吧 #include <iostream> #include <cstring> #include <cstdio> #include <cstdlib> #include <string>

原创 hdu 1159 整理下水題 遞推動規

Problem Description A subsequence of a given sequence is the given sequence with some elements (possible none) left o

原创 UVA 11988 Broken Keyboard (a.k.a. Beiju Text) 悲劇文本 鏈表

You’re typing a long text with a broken keyboard. Well it’s not so badly b

原创 hdu 1022 整理下水題 棧和隊列

Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to