原创 10-排序5 PAT Judge (25分)

The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are su

原创 11-散列4 Hashing - Hard Version (30分)

Given a hash table of size N, we can define a hash function . Suppose that the linear probing is used to solve collisi

原创 09-排序1 排序 (25分)

給定N個(長整型範圍內的)整數,要求輸出從小到大排序後的結果。 本題旨在測試各種不同的排序算法在各種數據情況下的表現。各組測試數據特點如下: 數據1:只有1個元素; 數據2:11個不相同的整數,測試基本正

原创 07-圖5 Saving James Bond - Hard Version (30分)

This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world

原创 10-排序6 Sort with Swap(0, i) (25分)

Given any permutation of the numbers {0, 1, 2,..., N−1}, it is easy to sort them in increasing order. But what if Swap

原创 11-散列3 QQ帳戶的申請與登陸 (25分)

實現QQ新帳戶申請和老帳戶登陸的簡化版功能。最大挑戰是:據說現在的QQ號碼已經有10位數了。 輸入格式: 輸入首先給出一個正整數N(≤10^5 ),隨後給出N行指令。每行指令的格式爲:“命令符(空格)QQ

原创 08-圖8 How Long Does It Take (25分)

Given the relations of all the activities of a project, you are supposed to find the earliest completion time of the p

原创 06-圖2 Saving James Bond - Easy Version (25分)

This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world

原创 08-圖9 關鍵活動 (30分)

假定一個工程項目由一組子任務構成,子任務之間有的可以並行執行,有的必須在完成了其它一些子任務後才能執行。“任務調度”包括一組子任務、以及每個子任務可以執行所依賴的子任務集。 比如完成一個專業的所有課程學習和畢業設計可以看成一個本科生要

原创 10-排序4 統計工齡 (20分)

給定公司N名員工的工齡,要求按工齡增序輸出每個工齡段有多少員工。 輸入格式: 輸入首先給出正整數N(≤10^5),即員工總人數;隨後給出N個整數,即每個員工的工齡,範圍在[0, 50]。 輸出格式: 按工齡的遞增順序輸出每個工齡的員工個

原创 09-排序3 Insertion or Heap Sort (25分)

According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and grow

原创 07-圖4 哈利·波特的考試 (25分)

哈利·波特要考試了,他需要你的幫助。這門課學的是用魔咒將一種動物變成另一種動物的本事。例如將貓變成老鼠的魔咒是haha,將老鼠變成魚的魔咒是hehe等等。反方向變化的魔咒就是簡單地將原來的魔咒倒過來念,例

原创 05-樹10 Huffman Codes (30分)

In 1953, David A. Huffman published his paper "A Method for the Construction of Minimum-Redundancy Cod

原创 09-排序2 Insert or Merge (25分)

According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and grow

原创 06-圖3 六度空間 (30分)

“六度空間”理論又稱作“六度分隔(Six Degrees of Separation)”理論。這個理論可以通俗地闡述爲:“你和任何一個陌生人之間所間隔的人不會超過六個,也就是說,最多通過五個人你就能夠認識任何一個陌生人。” “六度空間