摘要: Date:2019-05-16 21:12:35 图的存储 邻接表: 适合稀疏图,V多E少; 邻接矩阵: 适合稠密图,V少E多; 通常顶点数bu超过1e3时考虑用邻接矩阵,否则会超时; 图的遍历 DFS: BFS: 阅读全文
posted @ 2019-05-16 21:22 林東雨 阅读(533) 评论(0) 推荐(0) 编辑
摘要: Source: PAT 1148 Werewolf - Simple Version (20 分) Description: Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the were 阅读全文
posted @ 2019-05-16 20:52 林東雨 阅读(393) 评论(0) 推荐(0) 编辑
摘要: Source: PAT A1149 Dangerous Goods Packaging (25 分) Description: When shipping goods with containers, we have to be careful not to pack some incompatib 阅读全文
posted @ 2019-05-16 20:40 林東雨 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Source: PAT A1150 Travelling Salesman Problem (25 分) Description: The "travelling salesman problem" asks the following question: "Given a list of citi 阅读全文
posted @ 2019-05-16 20:29 林東雨 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Source: PAT A1151 LCA in a Binary Tree (30 分) Description: The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that ha 阅读全文
posted @ 2019-05-14 21:21 林東雨 阅读(312) 评论(0) 推荐(0) 编辑
摘要: Source: PAT A1078 Hashing (25 分) Description: The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, a 阅读全文
posted @ 2019-05-13 21:04 林東雨 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Source: PAT A1015 Reversible Primes (20 分) Description: A reversible prime in any number system is a prime whose "reverse" in that number system is al 阅读全文
posted @ 2019-05-12 22:00 林東雨 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 素数的判断: 获取素数表: 埃氏筛法(Eratosthenes): 时间复杂度:O( Nlog(logN) ) 第一个测出地球周长的男人-。- 欧氏筛法(Euler): 时间复杂度:O(N) 欧拉待过的俄法德,都曾是世界最强的国家,如果当初欧拉来中国,是不是咱们就年年ACM总冠军了-。- 阅读全文
posted @ 2019-05-12 21:31 林東雨 阅读(406) 评论(0) 推荐(0) 编辑
摘要: Source: PAT A1152 Google Recruitment (20 分) Description: In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown i 阅读全文
posted @ 2019-05-12 20:42 林東雨 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Source: PAT A1153 Decode Registration Card of PAT (25 分) Description: A registration card number of PAT consists of 4 parts: the 1st letter represents 阅读全文
posted @ 2019-05-12 20:01 林東雨 阅读(392) 评论(0) 推荐(0) 编辑