原创 練習集 L2-027 名人堂與代金券(25 分)(排序+排名)

對於在中國大學MOOC(http://www.icourse163.org/)學習“數據結構”課程的學生,想要獲得一張合格證書,總評成績必須達到 60 分及以上,並且有另加福利:總評分在 [G, 100] 區間內者,可以得到 50 元 P

原创 PAT 1038 Recover the Smallest Number(30 分)(頭文件#include)

Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given {

原创 #include下的str.find()函數

str.find(ss)//返回字符串ss在str中的位置 str.find(ss,num) //在str[num]~str[n-1]範圍內查找並返回字符串ss在str的位置 str.rfind(ss,num)////在str[0]~st

原创 ZCMU 4929: 連通圖(DFS+判斷是否連通)

Time Limit: 1 Sec  Memory Limit: 32 MB Submit: 3  Solved: 3 Description 給定一個無向圖和其中的所有邊,判斷這個圖是否所有頂點都是連通的。 Input 每組數據的第一行

原创 PAT 1083 List Grades(25 分)(排序)

Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the gra

原创 PAT 1033 To Fill or Not to Fill(25 分)(貪心)

With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is

原创 ZCMU 4942: 計算兩個矩陣的乘積

Time Limit: 1 Sec  Memory Limit: 32 MB Submit: 8  Solved: 4   Description 計算兩個矩陣的乘積,第一個是2*3矩陣,第二個是3*2矩陣,結果爲一個2*2矩陣。 Inp

原创 Dogs and Cages(數學 排列)

Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Description Jerry likes dogs. He has $N$ d

原创 解決eclipse運行中出現的端口被佔用問題

方法一 步驟一: 首先確定被佔用的端口 win+r cmd   找所有端口:netstat -ano 找確定端口:netstat -ano|findstr 8080 第二列最後幾位爲端口號  最後一列爲pid  步驟二 在任務管理器中找

原创 ZCMU 1679: 查找2(upper_bound()函數)

Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 396  Solved: 139 Description 給你一個長度是n的序列A,然後,有m次詢問,每次詢問是一個數字X,請你告訴我X在序列

原创 灌溉 (圖論+最小生成樹+並查集)

到了旱季農業生產的灌溉就成了一個大問題。爲了保證灌溉的順利,某縣政府決定投資爲各個村之間建立灌溉管道。 輸入第1行包括一個整數N,表示某縣的村莊的數量。(3≤N≤100),第2行-結尾爲一個N×N的矩陣,表示每個村莊之間的距離。雖然在理論

原创 ZCMU 1620: 全排列

Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 242  Solved: 112 Description 給定n個數 a[0] , a[1] ........ a[n-1], 輸出其全排列。

原创 ZCMU: 1821: 入學考試(dp揹包)

Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 30  Solved: 24 Description 辰辰是個天資聰穎的孩子,他的夢想是成爲世界上最偉大的醫師。爲此,他想拜附近最有威望的醫師

原创 1989: Julyed(水)

Time Limit: 2 Sec  Memory Limit: 64 MB Submit: 30  Solved: 28 Description Julyed is preparing for her CET-6. She has N

原创 PAT 1132 Cut Integer(20 分)(字符串)

Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For