原创 PAT 1035 Password(20 分)(字符串+switch case + vector)

To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are a

原创 ZCMU 4941: 繼續暢通工程(最小生成樹+並查集+Kruskal算法)

Time Limit: 1 Sec  Memory Limit: 32 MB Submit: 3  Solved: 3 Description 省政府“暢通工程”的目標是使全省任何兩個村莊間都可以實現公路交通(但不一定有直接的公路相連,只

原创 PAT 1133 Splitting A Linked List(25 分)(結構體+鏈表)

Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before al

原创 PAT 1145 Hashing - Average Search Time(25 分)(哈希+平均查找時間)

The task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try t

原创 PAT 1013 Battle Over Cities(25 分)(dfs)

It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all

原创 PAT 1022 Digital Library(30 分)(字符串查找+vector+結構體)

A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts,

原创 ZCMU 4926: 還是暢通工程(最小生成樹+並查集)

Time Limit: 1 Sec  Memory Limit: 32 MB Submit: 5  Solved: 4 Description         某省調查鄉村交通狀況,得到的統計表中列出了任意兩村莊間的距離。省政府“暢通工程

原创 #include<string>下的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

原创 PAT 1065 A+B and C (64bit)(20 分)(整數溢出)

Given three integers A, B and C in [−2​63​​,2​63​​], you are supposed to tell whether A+B>C. Input Specification: The f

原创 HDU 1232:暢通工程(連通分量+並查集)

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 69579    Accep

原创 PAT 1041 Be Unique(20 分)(哈希)

Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning

原创 PAT 1046 Shortest Distance(20 分)(簡單數組)

The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest

原创 PAT 1069 The Black Hole of Numbers(20 分)(do while循環)

For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing ord

原创 PAT 1019 General Palindromic Number(20 分)(進制轉換+迴文)

A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example,

原创 PAT 1028 List Sorting(25 分)(排序)

Excel can sort records according to any column. Now you are supposed to imitate this function. Input Specification: Eac