自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(58)
  • 收藏
  • 关注

原创 PAT甲级--1102 Invert a Binary Tree(25 分)【反转二叉树+层序遍历+中序遍历】

1102 Invert a Binary Tree(25 分)The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so ...

2018-08-31 21:01:12 292

原创 1069 The Black Hole of Numbers(20 分)

1069 The Black Hole of Numbers(20 分)For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order,...

2018-08-31 19:46:49 482

原创 1124 Raffle for Weibo Followers(20 分)

1124 Raffle for Weibo Followers(20 分)John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Weibo -- that is, he would select winners from every N fol...

2018-08-31 13:54:51 506

原创 PAT甲级--1116 Come on! Let's C(20 分)【模拟题+简单逻辑】

1116 Come on! Let's C(20 分)"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,...

2018-08-31 10:32:39 240

原创 PAT甲级--1138 Postorder Traversal(25 分)【前序+中序转成后序+输出后序第一个】

1138 Postorder Traversal(25 分)Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to output the first numb...

2018-08-31 09:37:39 217

原创 PAT--1136 A Delayed Palindrome(20 分)【大整数加法+reverse函数】

1136 A Delayed Palindrome(20 分)Consider a positive integer N written in standard notation with k+1 digits a​i​​ as a​k​​⋯a​1​​a​0​​ with 0≤a​i​​<10 for all i and a​k​​>0. Then N is palindromic...

2018-08-30 19:47:51 255

原创 PAT--1092 To Buy or Not to Buy(20 分)

1092 To Buy or Not to Buy(20 分)Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the...

2018-08-30 18:01:50 187

原创 PAT--1128 N Queens Puzzle(20 分)

1128 N Queens Puzzle(20 分)The "eight queens puzzle" is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other. Thus, a solution requires that no two...

2018-08-30 15:22:50 299

原创 PAT--1141 PAT Ranking of Institutions(25 分)

1141 PAT Ranking of Institutions(25 分)After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist.Inp...

2018-08-30 14:07:56 328

原创 PAT--L1-054 福到了(15 分)

L1-054 福到了(15 分)“福”字倒着贴,寓意“福到”。不论到底算不算民俗,本题且请你编写程序,把各种汉字倒过来输出。这里要处理的每个汉字是由一个 N × N 的网格组成的,网格中的元素或者为字符 @ 或者为空格。而倒过来的汉字所用的字符由裁判指定。输入格式:输入在第一行中给出倒过来的汉字所用的字符、以及网格的规模 N (不超过100的正整数),其间以 1 个空格分隔;随后 N ...

2018-08-30 10:02:57 2181 2

原创 前序中序后序转换

给出后序中序,转成前序,root根节点void pre(int root, int start, int end) { if(start > end) return ; int i = start; while(i < end && in[i] != post[root]) i++; printf("%d ", post[root]...

2018-08-29 10:35:52 747

原创 PAT甲级-1020 Tree Traversals(25 分)【后序中序+层序遍历】

1020 Tree Traversals(25 分)Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order t...

2018-08-29 10:18:52 241

原创 zcmu--4935: 成绩排序【结构体+sort排序】

4935: 成绩排序Time Limit: 1 Sec  Memory Limit: 32 MBSubmit: 13  Solved: 3[Submit][Status][Web Board]Description有N个学生的数据,将学生数据按成绩高低排序,如果成绩相同则按姓名字符的字母序排序,如果姓名的字母序也相同则按照学生的年龄排序,并输出N个学生排序后的信息。Input...

2018-08-28 20:57:41 577 1

原创 zcmu-4933: 二叉排序树【二叉排序树构造,搜索,前序中序后序遍历】

4933: 二叉排序树Time Limit: 1 Sec  Memory Limit: 32 MBSubmit: 5  Solved: 4[Submit][Status][Web Board]Description输入一系列整数,建立二叉排序数,并进行前序,中序,后序遍历。Input输入第一行包括一个整数n(1<=n<=100)。接下来的一行包括n个整数。O...

2018-08-28 20:18:43 563

原创 zcmu--4928: 二叉树【结点所在子树的结点数】

4928: 二叉树Time Limit: 1 Sec  Memory Limit: 32 MBSubmit: 7  Solved: 5[Submit][Status][Web Board]Description    如上所示,由正整数1,2,3……组成了一颗特殊二叉树。我们已知这个二叉树的最后一个结点是n。现在的问题是,结点m所在的子树中一共包括多少个结点。    比如,...

2018-08-28 19:26:40 688

原创 PAT甲级--1100 Mars Numbers(20 分)【map映射+字符串处理】

1100 Mars Numbers(20 分)People on Mars count their numbers with base 13:Zero on Earth is called "tret" on Mars. The numbers 1 to 12 on Earch is called "jan, feb, mar, apr, may, jun, jly, aug, sep,...

2018-08-28 14:21:04 284

原创 PAT甲级--1146 Topological Order(25 分)【判断是否为拓扑序列】

1146 Topological Order(25 分)This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are suppo...

2018-08-28 10:16:19 1496

原创 PAT甲级--1046 Shortest Distance(20 分)

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 distance between any pair of exits.Input Specifi...

2018-08-27 20:57:10 316

原创 zcmu--4922: 后缀子串排序【substr+字符串转为下标排序】

4922: 后缀子串排序Time Limit: 1 Sec  Memory Limit: 32 MBSubmit: 8  Solved: 4[Submit][Status][Web Board]Description对于一个字符串,将其后缀子串进行排序,例如grain其子串有:grainrainaininn然后对各子串按字典顺序排序,即:ain,grain,in,n...

2018-08-27 20:40:46 474

原创 zcmu-4932: 树查找【完全二叉树+输出指定层数节点】

不忘初心,砥砺前行!4932: 树查找Time Limit: 1 Sec  Memory Limit: 32 MBSubmit: 6  Solved: 4[Submit][Status][Web Board]Description有一棵树,输出某一深度的所有节点,有则输出这些节点,无则输出EMPTY。该树是完全二叉树。Input 输入有多组数据。每组输入一个n(1...

2018-08-27 16:48:51 1081

原创 zcmu-4931: 二叉树遍历【前序+中序,输出后序】

4931: 二叉树遍历Time Limit: 1 Sec  Memory Limit: 32 MBSubmit: 5  Solved: 5[Submit][Status][Web Board]Description二叉树的前序、中序、后序遍历的定义:前序遍历:对任一子树,先访问跟,然后遍历其左子树,最后遍历其右子树;中序遍历:对任一子树,先遍历其左子树,然后访问根,最后遍历其右...

2018-08-27 15:44:21 378

原创 PAT甲级--1147 Heaps(30 分)

1147 Heaps(30 分)In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater t...

2018-08-27 15:34:33 211

原创 PAT甲级--1023 Have Fun with Numbers(20 分)【大整数乘法】

1023 Have Fun with Numbers(20 分)Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happen...

2018-08-26 20:00:47 326

原创 PAT甲级--1061 Dating(20 分)

1061 Dating(20 分)Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm. It took him only a minute to figure out that th...

2018-08-26 19:55:30 332

原创 PAT甲级--1065 A+B and C (64bit)(20 分)【溢出(正正负,负负正)】

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 first line of the input gives the positive numb...

2018-08-26 16:15:37 258

原创 PAT甲级--1004 Counting Leaves(30 分)【层次遍历+dfs】

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...

2018-08-26 15:31:47 572

原创 PAT甲级--1005 Spell It Right (20)(20 分)

1005 Spell It Right (20)(20 分)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input ...

2018-08-25 19:12:02 212

原创 PAT甲级-1108 Finding Average(20 分)

1108 Finding Average(20 分)The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input numbers might not be le...

2018-08-25 18:41:07 352

原创 PAT甲级--1132 Cut Integer(20 分)

1132 Cut Integer(20 分)Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334, we have A = 167 and B ...

2018-08-25 16:01:25 260

原创 PAT甲级--1144 The Missing Number(20 分)

1144 The Missing Number(20 分)Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list.Input Specification:Each input file contains one test case. Fo...

2018-08-25 15:08:13 187

原创 PAT甲级--1031 Hello World for U(20 分)【模拟】

1031 Hello World for U(20 分)Given any string of N (≥5) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as:h de ll rlowoThat i...

2018-08-25 14:23:24 294

原创 PAT甲级-1019 General Palindromic Number(20 分)

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, 1234321 is a palindromic number. All singl...

2018-08-25 13:39:29 198

原创 PAT甲级-1015 Reversible Primes (20)(20 分)【判断素数+反过来转化成其他进制】

1015 Reversible Primes (20)(20 分)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 ...

2018-08-25 13:01:12 326

转载 【c++】size_t 和 size_type的区别

【c++】size_t 和 size_type的区别为了使自己的程序有很好的移植性,c++程序员应该尽量使用size_t和size_type而不是int, unsigned1. size_t是全局定义的类型;size_type是STL类中定义的类型属性,用以保存任意string和vector类对象的长度2. string::size_type 制类型一般就是unsigned int, ...

2018-08-25 10:23:06 285

原创 PAT甲级--1003 Emergency (25)(25 分)

1003 Emergency (25)(25 分)As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue t...

2018-08-24 13:13:44 287

原创 PAT甲级-1009 Product of Polynomials (25)(25 分)

1009 Product of Polynomials (25)(25 分)This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 l...

2018-08-24 09:02:50 121

原创 2018年省赛热身赛第9场-Problem A. Super-palindrome

Problem A. Super-palindromeYou are given a string that is consisted of lowercase English alphabet. You are supposed to change itinto a super-palindrome string in minimum steps. You can change one ...

2018-08-23 19:09:03 310

原创 PAT甲级-1008 Elevator (20)(20 分)

1008 Elevator (20)(20 分)The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in speci...

2018-08-22 20:51:47 272

原创 2018年省赛热身赛第8场-J - Convert QWERTY to Dvorak

J - Convert QWERTY to DvorakTime Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %lluSubmit StatusDescriptionEdward, a poor copy typist, is a user of the Dvorak Layout. Bu...

2018-08-22 20:04:33 258

原创 2018年省赛热身赛第8场 -H - May Day Holiday

H - May Day HolidayTime Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %lluSubmit StatusDescriptionAs a university advocating self-learning and work-rest balance, Marjar ...

2018-08-22 19:57:54 195

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除