![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
code
罗正燚
成长总是痛苦的,但也是充满希望的。没有经历苦难长大的叫做巨婴,烧不死的才是凤凰。
展开
-
1024 Palindromic Number (25 分)燚
1024 Palindromic Number (25 分)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 single digit...原创 2018-11-16 08:49:12 · 231 阅读 · 0 评论 -
PAT 1036 Boys vs Girls (25 分) 简单排序题 燚
This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains one t...原创 2018-12-01 18:33:08 · 173 阅读 · 0 评论 -
PAT 1060 Are They Equal (25 分)(关于测试点4与6错误) 极端测试样例 燚
If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123×105 with simple chopping. Now given the number of signif...原创 2018-12-01 18:12:26 · 1865 阅读 · 2 评论 -
PAT 1125 Chain the Ropes (25 分)贪心算法 结果向下取整(题目有歧义) 燚
Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into loops and chain them into one piece, as shown by the figure. The resulting chai...原创 2018-11-26 23:09:36 · 263 阅读 · 0 评论 -
PAT 1104 Sum of Number Segments (20 分) 数列阶梯式相加(AC的代码 和 有错误的代码) 燚
Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence { 0.1, 0.2, 0.3, 0.4 }, we have 10 segments: (0.1) (0.1, 0.2) (0.1, 0.2, 0.3...原创 2018-11-26 11:02:05 · 258 阅读 · 1 评论 -
PAT 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 queens share the same row, ...原创 2018-11-25 09:47:20 · 616 阅读 · 0 评论 -
PAT 1029 Median (25 分) 燚
Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = { 9, 10, 15, 16, 17 } is...原创 2018-11-28 22:27:31 · 229 阅读 · 0 评论 -
PAT 1067 Sort with Swap(0, i) 脚标与数组的关系 运行超时问题 燚
1067 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 ...原创 2018-11-24 22:59:33 · 232 阅读 · 0 评论 -
PAT 1103 Integer Factorization (30 分)深度有限搜索,关于运行超时问题 燚
The K−P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program to find the K−P factorization of N for any positive...原创 2018-11-24 20:44:05 · 512 阅读 · 1 评论 -
PAT 1045 Favorite Color Stripe (30) 分动态规划 最长前缀问题 燚
Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the remaining parts...原创 2018-11-24 20:01:36 · 175 阅读 · 0 评论 -
PAT 1035 Password (20 分)String的性质 燚
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L ...原创 2018-11-19 22:40:02 · 162 阅读 · 0 评论 -
PAT 1028 List Sorting (25 分)关于 Cin Cout 最后一个测试实例超时 燚
Excel can sort records according to any column. Now you are supposed to imitate this function.Input Specification:Each input file contains one test case. For each case, the first line contains two...原创 2018-11-17 18:56:53 · 425 阅读 · 0 评论 -
PAT 1030 Travel Plan (30 分)迪杰斯特拉算法 燚
A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path b...原创 2018-11-17 18:37:30 · 249 阅读 · 0 评论 -
PAT 1014 Waiting in Line (30 分)燚
Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are:The space...原创 2018-11-16 22:30:04 · 185 阅读 · 0 评论 -
PTA 1027 Colors in Mars (20 分)燚
People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 ...原创 2018-11-22 21:55:43 · 118 阅读 · 0 评论 -
PAT 1017 Queueing at Bank (25 分)燚
Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yellow li...原创 2018-11-16 18:25:06 · 120 阅读 · 0 评论 -
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 ...原创 2018-11-15 18:38:56 · 312 阅读 · 0 评论 -
PAT 1021 Deepest Root (25 分)(最后两个测试点错误)燚
A graph which is connected and acyclic can be considered a tree. The hight 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 i...原创 2018-12-15 21:38:36 · 2156 阅读 · 0 评论