PAT
文章平均质量分 70
立风水曰
这个作者很懒,什么都没留下…
展开
-
A1112 Stucked Keyboard (20)
A1112 Stucked Keyboard (20) #include<cstdio> #include<algorithm> #include<vector> #include<cstring> using namespace std; const int maxk = 1300; const int maxn = 300; int K; char s1[maxk], s2[maxk]; //bool isPrint[maxn] = {false};原创 2020-06-12 11:39:56 · 159 阅读 · 0 评论 -
1017 Queueing at Bank (25point(s))
1017 Queueing at Bank (25point(s)) #include<cstdio> #include<algorithm> using namespace std; const int maxn = 10010; const int maxk = 110; int N, K; struct Node{ int hh,mm,ss; int time; int process; }customer[maxn]; bool cmp(Node a, Node原创 2020-05-17 20:28:11 · 155 阅读 · 0 评论 -
A1007 Maximum Subsequence Sum (25point(s))
A1007 Maximum Subsequence Sum (25point(s)) #include<cstdio> #include<algorithm> using namespace std; const int maxn = 10010; int K; int dp[maxn], s[maxn], a[maxn]; int main(){ bool fla...原创 2020-05-06 15:33:52 · 150 阅读 · 0 评论 -
A1006 Sign In and Sign Out (25point(s))
A1006 Sign In and Sign Out (25point(s)) #include<cstdio> #include<algorithm> using namespace std; const int maxm = 1000; int M; struct Node{ char ID[20]; int InTime; int OutTime; } n...原创 2020-05-02 14:02:27 · 1107 阅读 · 0 评论 -
A1004 Counting Leaves (30point(s))
A1004 Counting Leaves (30point(s)) #include<cstdio> #include<algorithm> #include<vector> #include<queue> using namespace std; const int maxn = 101; int N, M; struct Node{ ve...原创 2020-04-30 22:14:29 · 127 阅读 · 0 评论 -
11-散列4 Hashing - Hard Version (30 分)
Given a hash table of size N, we can define a hash function H(x)=x%N. Suppose that the linear probing is used to solve collisions, we can easily obtain the status of the hash table with a given sequen...原创 2019-08-30 07:58:46 · 455 阅读 · 0 评论 -
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’s most famous spy, was captured by a group of drug dealers. He was sent to a small piece of land ...原创 2019-08-30 13:18:34 · 129 阅读 · 0 评论 -
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 project. Input Specification: Each input file contains one test case. Each case sta...原创 2019-09-03 19:37:55 · 184 阅读 · 0 评论 -
09-排序3 Insertion or Heap Sort (25 分)
According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, ...原创 2019-09-05 14:49:45 · 104 阅读 · 0 评论 -
1004 Counting Leaves (30 分)
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Specification: Each input file contains one test case. Each case starts w...原创 2019-09-07 17:56:59 · 90 阅读 · 0 评论 -
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(0, *) is the ONLY operation that is allowed to use? For example, to sort {4, 0, 2, ...原创 2019-08-29 15:22:50 · 165 阅读 · 0 评论 -
07-图4 哈利·波特的考试 (25 分)
哈利·波特要考试了,他需要你的帮助。这门课学的是用魔咒将一种动物变成另一种动物的本事。例如将猫变成老鼠的魔咒是haha,将老鼠变成鱼的魔咒是hehe等等。反方向变化的魔咒就是简单地将原来的魔咒倒过来念,例如ahah可以将老鼠变成猫。另外,如果想把猫变成鱼,可以通过念一个直接魔咒lalala,也可以将猫变老鼠、老鼠变鱼的魔咒连起来念:hahahehe。 现在哈利·波特的手里有一本教材,里面列出了所有...原创 2019-08-23 12:06:10 · 124 阅读 · 0 评论 -
11-散列1 电话聊天狂人 (25 分)
给定大量手机用户通话记录,找出其中通话次数最多的聊天狂人。 输入格式: 输入首先给出正整数N(≤10 5 ),为通话记录条数。随后N行,每行给出一条通话记录。简单起见,这里只列出拨出方和接收方的11位数字构成的手机号码,其中以空格分隔。 输出格式: 在一行中给出聊天狂人的手机号码及其通话次数,其间以空格分隔。如果这样的人不唯一,则输出狂人中最小的号码及其通话次数,并且附加给出并列狂人的人数...原创 2019-08-24 17:40:30 · 178 阅读 · 0 评论 -
09-排序2 Insert or Merge (25 point(s))
According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, ...原创 2019-08-25 07:34:12 · 113 阅读 · 0 评论 -
07-图6 旅游规划 (25 分)
有了一张自驾旅游路线图,你会知道城市间的高速公路长度、以及该公路要收取的过路费。现在需要你写一个程序,帮助前来咨询的游客找一条出发地和目的地之间的最短路径。如果有若干条路径都是最短的,那么需要输出最便宜的一条路径。 输入格式: 输入说明:输入数据的第1行给出4个正整数N、M、S、D,其中N(2≤N≤500)是城市的个数,顺便假设城市的编号为0~(N−1);M是高速公路的条数;S是出发地的城市编号;...原创 2019-08-23 12:03:42 · 184 阅读 · 0 评论