![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
文章平均质量分 56
ninesun127
有一个目标,总能让我们欢欣鼓舞~
展开
-
pat甲1110. Complete Binary Tree(完全二叉树)
1110. Complete Binary Tree (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a tree, you are supposed to tel原创 2016-12-09 20:28:10 · 290 阅读 · 0 评论 -
pat甲 1001.A+B Format
1001. A+B Format (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueCalculate a + b and output the sum in standard原创 2016-11-15 20:35:47 · 246 阅读 · 0 评论 -
pat 甲1113. Integer Set Partition(排序水题)
1113. Integer Set Partition (25)时间限制150 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a set of N (> 1) positive inte原创 2017-02-28 16:58:34 · 196 阅读 · 0 评论 -
pat 甲1114. Family Property (dfs)
1114. Family Property (25)时间限制150 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis time, you are supposed to help us col原创 2017-02-28 16:09:10 · 216 阅读 · 0 评论 -
pat甲1122. Hamiltonian Cycle(哈密顿回路+简单dfs)
1122. Hamiltonian Cycle (25)时间限制300 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe "Hamilton cycle problem" is to find原创 2016-12-15 13:37:50 · 1783 阅读 · 0 评论 -
pat甲1020. Tree Traversals(已知后序和中序求层次遍历)
1020. Tree Traversals (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueSuppose that all the keys in a binary tree原创 2016-12-09 19:12:01 · 332 阅读 · 0 评论 -
pat甲1102. Invert a Binary Tree(二叉树的反转与遍历)
1102. Invert a Binary Tree (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe following is from Max Howell @twi原创 2016-12-09 16:50:16 · 343 阅读 · 0 评论 -
pat甲1004. Counting Leaves
pat甲1004. Counting LeavesA family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains one test case. Each case starts with a line containing 0 < N < 100, the numbe原创 2016-11-27 18:07:17 · 324 阅读 · 0 评论 -
pat甲1119. Pre- and Post-order Traversals (已知前序和后序遍历求中序遍历)
pat甲1119.pat advanced level 119. Pre- and Post-order Traversals (30)Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences, or preorder原创 2016-12-08 21:51:32 · 935 阅读 · 0 评论 -
pat甲1078. Hashing(hash+Quadratic probing 平方探测)
pat甲1078. Hashing(hash+平方探测法)pat advanced level 1078. Hashing(hash+平方探测法) The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined to原创 2016-12-08 15:28:55 · 1167 阅读 · 0 评论 -
pat甲1101. Quick Sort(水题)
pat甲1101. Quick Sort (25)pat advanced level 1101. Quick Sort (25)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CAO, PengThere is a classical process named partition in原创 2016-12-08 13:23:36 · 278 阅读 · 0 评论 -
pat甲1120. Friend Numbers(水题string+set)
1120. Friend Numbers (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueTwo integers are called "friend numbers" if原创 2016-12-13 18:43:11 · 277 阅读 · 0 评论 -
pat甲1011. World Cup Betting(水题)
pat甲1011. World Cup BettingWith the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly, football betting fa原创 2016-11-24 21:32:35 · 223 阅读 · 0 评论 -
pat甲1021.Deepest Root(简单dfs)
pat甲1021.Deepest Root(简单dfs)A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root is called the deepest root.原创 2016-11-24 21:15:08 · 628 阅读 · 0 评论 -
pat甲1022. Digital Library(string,set,sstream)
pat甲1022. Digital Library (30)A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number as its ID. Given any query原创 2016-11-24 20:24:48 · 238 阅读 · 0 评论 -
pat甲1116. Come on! Let's C(模拟)
pat甲1116. Come on! Let's C(模拟)"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun, the award rules are funny as the following:0. The Ch原创 2016-12-04 16:11:13 · 239 阅读 · 0 评论 -
pat 甲 1112. Stucked Keyboard (字符串)
1112. Stucked Keyboard (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueOn a broken keyboard, some of the keys ar原创 2017-02-28 20:47:37 · 192 阅读 · 0 评论 -
pat甲 1066. Root of AVL Tree (AVL树)
1066. Root of AVL Tree (25)时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueAn AVL tree is a self-balancing binary se原创 2017-03-01 20:51:14 · 294 阅读 · 0 评论 -
pat甲 1103. Integer Factorization ( dfs)
1103. Integer Factorization (30)时间限制1200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe K-P factorization of a positive原创 2017-03-02 18:11:56 · 312 阅读 · 0 评论 -
团队程序设计天梯赛 L3-011. 直捣黄龙(dijkstra+搜索)
L3-011. 直捣黄龙时间限制150 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越本题是一部战争大片 —— 你需要从己方大本营出发,一路攻城略地杀到敌方大本营。首先时间就是生命,所以你必须选择合适的路径,以最快原创 2017-04-05 20:45:39 · 534 阅读 · 0 评论 -
团体程序设计天梯赛 L3-003. 社交集群(并差集)
社交集群在社交网络平台注册时,用户通常会输入自己的兴趣爱好,以便找到和自己兴趣相投的朋友。有部分兴趣相同的人们就形成了“社交集群”。现请你编写程序,找出所有的集群。现请你编写程序,找出所有的集群。原创 2017-04-05 19:05:45 · 547 阅读 · 0 评论 -
团体程序设计天梯赛 L2-020. 功夫传人(多叉树搜索)
L2-020. 功夫传人时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越一门武功能否传承久远并被发扬光大,是要看缘分的。一般来说,师傅传授给徒弟的武功总要打个折扣,于是越往后传,弟子们的功夫就越弱……原创 2017-04-05 17:25:52 · 418 阅读 · 0 评论 -
团体程序设计天梯赛 L2-001. 紧急救援(dijkstra)
L2-001. 紧急救援时间限制200 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者陈越作为一个城市的应急救援队伍的负责人,你有一张特殊的全国地图。在地图上显示有多个分散的城市和一些连接城市的快速道路。每个城市的救援原创 2017-04-04 20:39:37 · 321 阅读 · 0 评论 -
团体程序设计天梯赛 L3-007. 天梯地图(dijkstral+记录所有最短路径)
L3-007. 天梯地图 团体程序设计天梯赛 L3-007. 天梯地图本题要求你实现一个天梯赛专属在线地图,队员输入自己学校所在地和赛场地点后,该地图应该推荐两条路线:一条是最快到达路线;一条是最短条是最短距离的路线。题目保证对任意的查询请求,地图上都至少存在一条可达路线。输入格式:输入在第一行给出两个正整数N(2 <= N <=500)和M,分别为地图中所有标记地点的个数和连接地点的道路条数。随后M行,每行按如下格式给出一条道路的信息:原创 2017-04-03 15:10:27 · 1403 阅读 · 0 评论 -
pat 甲1003. Emergency(最短路)
1003. Emergency (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueAs an emergency rescue team leader of a city, yo原创 2016-11-16 17:12:32 · 344 阅读 · 0 评论 -
pat 甲1126. Eulerian Path (欧拉图的判定)
1126. Eulerian Path (25)时间限制300 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueIn graph theory, an Eulerian path is a path原创 2017-03-07 19:14:23 · 315 阅读 · 0 评论 -
pat 甲1124. Raffle for Weibo Followers (水题)
1124. Raffle for Weibo Followers (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueJohn got a full mark on PAT. He原创 2017-03-07 18:34:54 · 194 阅读 · 0 评论 -
pat 甲1125. Chain the Ropes (贪心)
1125. Chain the Ropes (25)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven some segments of rope, you are suppo原创 2017-03-05 18:30:18 · 280 阅读 · 0 评论 -
pat 甲1127. ZigZagging on a Tree (已知后序及中序建树,并层次往返输出)
1127. ZigZagging on a Tree (30)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueSuppose that all the keys in a binary原创 2017-03-05 18:01:25 · 3002 阅读 · 0 评论 -
pat 甲1121. Damn Single (水题)
1121. Damn Single (25)时间限制300 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, Yue"Damn Single (单身狗)" is the Chinese nickname fo原创 2017-02-26 21:23:29 · 266 阅读 · 0 评论 -
pat甲 1023. Have Fun with Numbers(模拟+set)
1023. Have Fun with Numbers (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueNotice that the number 123456789 is原创 2017-02-25 19:03:17 · 228 阅读 · 0 评论 -
pat甲1123. Is It a Complete AVL Tree (AVL树+层次遍历+完全二叉树)
pat advanced level 1123. Is It a Complete AVL Tree (30)pat甲1123. Is It a Complete AVL Tree An AVL tree is a self-balancing An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by a原创 2016-12-13 17:22:03 · 1169 阅读 · 0 评论 -
pat 甲1010. Radix(二分)
pat 甲1010. Radix(二分)iven a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is a binary number.Now for any pair of positive integers N1 and N2, your task is to fi原创 2016-11-19 19:45:34 · 1110 阅读 · 1 评论 -
pat 甲 1099. Build A Binary Search Tree (二叉搜索树)
1099. Build A Binary Search Tree (30)时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA Binary Search Tree (BST) is r原创 2017-03-03 16:45:52 · 248 阅读 · 0 评论 -
pat甲1118. Birds in Forest(并查集)
pat甲1118. Birds in Forest(并查集)Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree. You are supposed to help the scientists to count the maximum number of trees in the原创 2016-12-04 16:01:21 · 331 阅读 · 0 评论 -
pat甲1015. Reversible Primes(水题)
pat甲1015. Reversible Primes(水题)A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime.Now given any two原创 2016-12-03 14:49:30 · 1307 阅读 · 0 评论 -
pat甲1013. Battle Over Cities(dfs)
pat甲1013. Battle Over Cities(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 the highways from/toward that city are closed. We must know immediately if we need to repair any other h原创 2016-12-03 13:51:02 · 242 阅读 · 0 评论 -
pat 乙 1008. 数组元素循环右移问题
#includeusing namespace std;int a[102];int main(){ int n,m; cin>>n>>m; m=m%n; for(int i=0;i<n;i++) { cin>>a[i]; } cout<<a[(n-m)%n]; for(int i=n-m+1;i<=n-1;i++) { cout<<" "<<a[原创 2016-09-08 15:24:26 · 239 阅读 · 0 评论 -
pat 乙 1007. 素数对猜想
#include#includeusing namespace std;int n;bool isprime(int n){ for(int i=2;i<=sqrt(n);i++) { if(n%i==0)return false; } return true;}int main(){ cin>>n; int cnt=0; for(int i=5;原创 2016-09-08 15:22:34 · 210 阅读 · 0 评论 -
pat 乙 1006. 换个格式输出整数
#includeusing namespace std;int d[10];int size=0;int main(){ int num; cin>>num; int n=num; while(n/10) { d[size++]=n%10; n/=10; } d[size++]=n; for(int i=0;i<d[2];i++) { co原创 2016-09-08 15:04:18 · 160 阅读 · 0 评论