PAT 记录一下我刷PAT的经历,参考了晴神和柳神的题解 由于Python3本身的原因(还有我太菜了),部分题Python3有1,2个测试点超时,如果有不超时的解法也希望能分享一下 题号 知识点 C++ Python3 1001 字符串处理 A+B Format A+B Format 1002 数学模拟 A+B for Polynomials A+B for Polynomials 1003 最短路 Emergency Emergency 1004 树的遍历 Counting Leaves Counting Leaves 1005 字符串处理 Spell It Right Spell It Right 1006 排序查找 Sign In and Sign Out Sign In and Sign Out 1007 动态规划 Maximum Subsequence Sum Maximum Subsequence Sum 1008 数学 Elevator Elevator 1009 数学模拟 Product of Polynomials Product of Polynomials 1010 二分查找 Radix Radix 1011 排序查找 World Cup Betting World Cup Betting 1012 排序查找 The Best Rank The Best Rank 1013 DFS Battle Over Cities Battle Over Cities-超时 1014 1015 素数 Reversible Primes Reversible Primes 1016 1017 1018 最短路 Public Bike Management Public Bike Management-22分 1019 进制转换 General Palindromic Number General Palindromic Number 1020 二叉树遍历 Tree Traversals Tree Traversals 1021 DFS Deepest Root Deepest Root 1022 排序 Digital Library Digital Library 1023 数学 Have Fun with Numbers Have Fun with Numbers 1024 数学 Palindromic Number Palindromic Number 1025 结构体排序 PAT Ranking PAT Ranking-超时 1026 1027 进制转换 Colors in Mars Colors in Mars 1028 排序 List Sorting List Sorting-超时 1029 双指针 Median Median-超时 1030 最短路 Travel Plan Travel Plan 1031 画图 Hello World for U Hello World for U 1032 链表 Sharing Sharing 1033 贪心 To Fill or Not to Fill To Fill or Not to Fill 1034 DFS Head of a Gang Head of a Gang 1035 字符串处理 Password Password 1036 排序查找 Boys vs Girls Boys vs Girls 1037 贪心排序 Magic Coupon Magic Coupon 1038 排序 Recover the Smallest Number Recover the Smallest Number 1039 查找 Course List for Student Course List for Student-非0返回 1040 DP Longest Symmetric String Longest Symmetric String 1041 哈希 Be Unique Be Unique 1042 模拟 Shuffling Machine Shuffling Machine 1043 BST Is It a Binary Search Tree Is It a Binary Search Tree-非0返回 1044 二分 Shopping in Mars Shopping in Mars 1045 DP Favorite Color Stripe Favorite Color Stripe 1046 预处理 Shortest Distance Shortest Distance 1047 排序 Student List for Course Student List for Course-超时 1048 哈希 Find Coins Find Coins 1049 数学 Counting Ones Counting Ones 1050 哈希 String Subtraction String Subtraction 1051 栈 Pop Sequence Pop Sequence 1052 链表 Linked List Sorting Linked List Sorting-超时 1053 树的遍历 Path of Equal Weight Path of Equal Weight 1054 哈希 The Dominant Color The Dominant Color-超时 1055 排序 The World's Richest The World's Richest-超时 1056 模拟 Mice and Rice The World's Richest 1057 树状数组 Stack 这题三个超时点 1058 进制转换 A+B in Hogwarts A+B in Hogwarts 1059 数学 Prime Factors Prime Factors 1061 字符串处理 Dating Dating 1062 排序 Talent and Virtue Talent and Virtue-超时 1063 set Set Similarity Set Similarity 1064 BST Complete Binary Search Complete Binary Search 1065 溢出 A+B and C (64bit) A+B and C (64bit) 1066 AVL Root of AVL Tree Root of AVL Tree 1067 贪心排序 Sort with Swap(0, i) Sort with Swap(0, i)-超时 1069 数学 The Black Hole of Numbers The Black Hole of Numbers 1070 排序贪心 Mooncake Mooncake 1071 字符串 Speech Patterns Mooncake 1072 最短路 Gas Station Gas Station-超时 1073 字符串处理 Scientific Notation Scientific Notation 1074 链表 Reversing Linked List Reversing Linked List-超时 1075 排序 PAT Judge PAT Judge-超时 1076 BFS Forwards on Weibo Forwards on Weibo-超时 1077 字符串处理 Kuchiguse Kuchiguse 1078 哈希 Hashing Hashing 1079 树的遍历 Total Sales of Supply Chain Total Sales of Supply Chain-超时 1080 排序 Graduate Admission Graduate Admission-超时 1081 分数 Rational Sum Rational Sum 1082 字符串处理 Read Number in Chinese Read Number in Chinese 1083 排序 List Grades List Grades 1084 哈希 Broken Keyboard Broken Keyboard 1085 二分查找 Perfect Sequence Perfect Sequence-超时 1086 二叉树遍历 Tree Traversals Again Tree Traversals Again 1087 最短路 All Roads Lead to Rome All Roads Lead to Rome 1088 分数 Rational Arithmetic Rational Arithmetic-15分一个点格式错误 1089 排序 Insert or Merge Insert or Merge 1090 二叉树遍历 Highest Price in Supply Chain Highest Price in Supply Chain-超时 1091 BFS Acute Stroke Acute Stroke-超时 1094 树的遍历 The Largest Generation The Largest Generation 1096 数学 Consecutive Factors Consecutive Factors 1097 链表 Deduplication on a Linked List Deduplication on a Linked List-超时 1098 排序 Insertion or Heap Sort Insertion or Heap Sort 1099 BST Build A Binary Search Tree Build A Binary Search Tree 1100 进制转换 Mars Numbers Mars Numbers 1101 双指针 Quick Sort Quick Sort-超时 1102 二叉树遍历 Invert a Binary Tree Invert a Binary Tree 1103 DFS Integer Factorization Integer Factorization-超时 1104 数学 Sum of Number Segments Sum of Number Segments-超时 1105 模拟 Spiral Matrix Spiral Matrix 1106 树的遍历 Lowest Price in Supply Chain Lowest Price in Supply Chain-超时 1107 并查集 Social Clusters Social Clusters 1108 字符串 Finding Average Finding Average 1109 队列 Group Photo Group Photo 1110 二叉树 Complete Binary Tree Complete Binary Tree 1111 最短路 Online Map Online Map-超时 1112 哈希 Stucked Keyboard Stucked Keyboard 1113 排序 Integer Set Partition Integer Set Partition 1114 DFS Family Property Family Property-一个点非零返回 1115 BST Counting Nodes in a BST Counting Nodes in a BST-非零返回 1116 查询 Come on! Let's C Come on! Let's C 1117 数学 Eddington Number Eddington Number 1118 并查集 Birds in Forest Birds in Forest 1119 树的遍历 Pre- and Post-order Traversals Pre- and Post-order Traversals 1120 数学 Friend Numbers Friend Numbers 1121 查找 Damn Single Damn Single 1122 判断 Hamiltonian Cycle Hamiltonian Cycle 1123 AVL Is It a Complete AVL Tree Is It a Complete AVL Tree-23分 1124 简单模拟 Raffle for Weibo Followers Raffle for Weibo Followers 1125 简单模拟 Chain the Ropes Chain the Ropes 1126 欧拉回路 Eulerian Path Eulerian Path 1127 树的构造 ZigZagging on a Tree ZigZagging on a Tree 1128 简单判断 N Queens Puzzle N Queens Puzzle-超时 1129 排序 Recommendation System Recommendation System 1130 树的遍历 Infix Expression Infix Expression 1131 DFS+剪枝 Subway Map Subway Map 1132 字符串 Cut Integer Cut Integer 1133 链表 Splitting A Linked List Splitting A Linked List 1134 图的遍历 Vertex Cover Vertex Cover 1135 红黑树 Is It A Red-Black Tree Is It A Red-Black Tree 1136 大数 A Delayed Palindrome A Delayed Palindrome 1137 排序 Final Grading-一个点错误 搁置一下 Final Grading 1138 树的遍历 Postorder Traversal Postorder Traversal-超内存 1139 查找 First Contact First Contact 1140 字符串 Look-and-say Sequence Look-and-say Sequence 1141 排序 PAT Ranking of Institutions PAT Ranking of Institutions-超时 1142 图 Maximal Clique Maximal Clique-超时 1143 LCA Lowest Common Ancestor Lowest Common Ancestor-超时 1144 哈希 The Missing Number The Missing Number 1145 哈希 Hashing - Average Search Time Hashing - Average Search Time 1146 拓扑排序 Topological Order Topological Order 1147 堆 Heaps Heaps-超时 1148 枚举 Werewolf - Simple Version Werewolf - Simple Version 1149 查找 Dangerous Goods Packaging Dangerous Goods Packaging 1150 图 Travelling Salesman Problem Travelling Salesman Problem-超时 1151 LCA LCA in a Binary Tree LCA in a Binary Tree-超时-非零返回 1152 素数 Google Recruitment Google Recruitment 1153 查找 Decode Registration Card of PAT Decode Registration Card of PAT-超时 1154 图 Vertex Coloring Vertex Coloring 1155 堆 Heap Paths Heap Paths