PAT甲级
文章平均质量分 83
征服所有不服
行走在西子湖畔,我是江南最尊贵的神犇。流浪在CSDN,我是世间最美的情郎。
展开
-
2021年3月春季PAT甲级满分总结(附考场代码)
分享一些备考的经验和经历一、考试经历考前准备考前小状况线上考试步骤二、题解(考场原版代码)1、 Arithmetic Progression of Primes2、Lab Access Scheduling3、Structure of Max-Heap4、Recycling of Shared Bicycles三、总结一、考试经历本次线上考试100分,一个半小时左右AK(退系统前看了下排名我是第22个满分),四道题分别是dfs、区间贪心模板题、堆、flyod模板题,没有去年那样的坑人题目,算是正常难度吧原创 2021-03-15 23:08:36 · 3898 阅读 · 14 评论 -
【剑指紫金港】1059 Prime Factors
A 1059 Prime Factors题目链接Problem DescriptionGiven any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1 k1 ×p2 k2 ×⋯×pm km .InputEach input file contains one test case原创 2021-03-03 12:56:19 · 70 阅读 · 0 评论 -
【剑指紫金港】1045 Favorite Color Stripe 贪心
A 1045 Favorite Color Stripe题目链接Problem DescriptionEva 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 t原创 2021-02-28 12:21:38 · 65 阅读 · 0 评论 -
【剑指紫金港】1145 Hashing - Average Search Time 平方探查法
A 1145 Hashing - Average Search Time题目链接Problem DescriptionThe task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try to find another sequence of integer keys from the table and output the avera原创 2021-02-17 13:26:18 · 134 阅读 · 0 评论 -
【剑指紫金港】1143 Lowest Common Ancestor
A 1143 Lowest Common Ancestor题目链接Problem DescriptionThe lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.A binary search tree (BST) is recursively defined as a binary tree which has th原创 2021-02-17 10:32:06 · 59 阅读 · 0 评论 -
【剑指紫金港】1136 A Delayed Palindrome 字符串骚操作
A 1136 A Delayed Palindrome题目链接Problem DescriptionConsider a positive integer N written in standard notation with k+1 digits ai as ak ⋯a1 a0 with 0≤ai <10 for all i and ak >0. Then N is palindromic if and only if ai =ak−i原创 2021-02-15 17:24:57 · 78 阅读 · 0 评论 -
【剑指紫金港】1131 Subway Map 地铁乘车规划
A 1131 Subway Map题目链接Problem DescriptionIn the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing subway. Now you are supposed to help people with your computer sk原创 2021-02-15 00:08:02 · 160 阅读 · 0 评论 -
【剑指紫金港】1129 Recommendation System Set妙用
A 1129 Recommendation System题目链接Problem DescriptionRecommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates the user’s preference by the number of times原创 2021-02-14 20:40:20 · 75 阅读 · 0 评论 -
【剑指紫金港】1123 Is It a Complete AVL Tree 完全AVL树模板
A 1123 Is It a Complete AVL Tree题目链接Problem DescriptionAn 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 at most one; if at any time they differ by more than one, rebalancing原创 2021-02-13 16:16:24 · 74 阅读 · 0 评论 -
【剑指紫金港】1119 Pre- and Post-order Traversals 全网最易懂的非递归版
A 1119 Pre- and Post-order Traversals题目链接Problem DescriptionSuppose 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 and i原创 2021-02-13 10:29:12 · 128 阅读 · 0 评论 -
【剑指紫金港】1117 Eddington Number 大年初一第一篇!
A 1117 Eddington Number题目链接Problem DescriptionBritish astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an “Eddington number”, E – that is, the maximum integer E such that it is for E days tha原创 2021-02-12 20:22:14 · 77 阅读 · 0 评论 -
【剑指紫金港】1112 Stucked Keyboard
A 1112 Stucked Keyboard题目链接Problem DescriptionOn a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear repeatedly on screen for k times.Now given a resulting stri原创 2021-02-10 22:28:01 · 102 阅读 · 0 评论 -
【剑指紫金港】1110 Complete Binary Tree 完全二叉树静态实现
A 1110 Complete Binary Tree题目链接Problem DescriptionGiven a tree, you are supposed to tell if it is a complete binary tree.InputEach input file contains one test case. For each case, the first line gives a positive integer N (≤20) which is the total num原创 2021-02-10 12:26:05 · 119 阅读 · 0 评论 -
【剑指紫金港】1108 Finding Average(sscanf和sprintf)
A 1108 Finding Average题目链接Problem DescriptionThe 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 legal. A legal input is a real number原创 2021-02-09 22:07:58 · 80 阅读 · 0 评论 -
【剑指紫金港】1103 Integer Factorization N皇后思想
A 1103 Integer Factorization题目链接Problem DescriptionThe 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 i原创 2021-02-09 20:36:18 · 362 阅读 · 0 评论 -
【剑指紫金港】1105 Spiral Matrix 贪吃蛇算法
A 1105 Spiral Matrix题目链接Problem DescriptionThis time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the first element at the upper-left corner, then move in a clockwi原创 2021-02-09 16:04:36 · 86 阅读 · 0 评论 -
【剑指紫金港】1104 Sum of Number Segments
A 1104 Sum of Number Segments题目链接Problem DescriptionGiven 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)原创 2021-02-09 15:57:24 · 44 阅读 · 0 评论 -
【剑指紫金港】1099 Build A Binary Search Tree 根据BST的结构求层序
A 1099 Build A Binary Search Tree题目链接Problem DescriptionA Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The right s原创 2021-02-08 15:50:58 · 62 阅读 · 0 评论 -
【剑指紫金港】1096 Consecutive Factors 阶乘
A 1096 Consecutive Factors题目链接Problem DescriptionAmong all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3×5×6×7, where 5, 6, and 7 are the three consecutive numbers. Now given any原创 2021-02-08 11:58:50 · 64 阅读 · 0 评论 -
【剑指紫金港】1085 Perfect Sequence
A 1085 Perfect Sequence题目链接Problem DescriptionGiven a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m×p where M and m are the maximum and minimum numbers in the sequence, respectively.N原创 2021-02-07 17:28:06 · 47 阅读 · 0 评论 -
【剑指紫金港】1086 Tree Traversals Again 已知先序中序求后序
A 1086 Tree Traversals Again题目链接Problem DescriptionAn inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stack原创 2021-02-07 16:19:18 · 61 阅读 · 0 评论 -
【剑指紫金港】1076 Forwards on Weibo BFS和DFS我都可
A 1076 Forwards on Weibo题目链接Problem DescriptionWeibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user m原创 2021-02-06 10:56:22 · 60 阅读 · 0 评论 -
【剑指紫金港】1088 Rational Arithmetic 分数计算
A 1088 Rational Arithmetic题目链接Problem DescriptionFor two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.InputEach input file contains one test case, which gives in o原创 2021-02-04 23:38:48 · 85 阅读 · 0 评论 -
【剑指紫金港】1064 Complete Binary Search Tree 填空完全二叉搜索树
A 1064 Complete Binary Search Tree题目链接Problem DescriptionA Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The right原创 2021-02-03 23:42:07 · 94 阅读 · 0 评论 -
【剑指紫金港】1051 Pop Sequence 栈模拟
A 1051 Pop Sequence题目链接Problem DescriptionGiven a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, …, N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For原创 2021-02-02 22:36:57 · 102 阅读 · 0 评论 -
【剑指紫金港】1044 Shopping in Mars 区间查询二分搜索优化
A 1044 Shopping in Mars题目链接Problem DescriptionShopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, the chain can be cut at any position for onl原创 2021-02-01 22:31:40 · 77 阅读 · 0 评论 -
【剑指紫金港】1043 Is It a Binary Search Tree 二叉搜索树
题目标题题目链接Problem DescriptionInputOutputSample Input:ASample Output:2题目大意:牛解题思路:龙AC代码#include<bits/stdc++.h>using namespace std;原创 2021-02-01 16:17:45 · 114 阅读 · 0 评论 -
【剑指紫金港】1040 Longest Symmetric String DP回文字符串
A 1040 Longest Symmetric String DP回文字符串题目链接Problem DescriptionGiven a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, h原创 2021-02-01 11:02:58 · 86 阅读 · 0 评论 -
【剑指紫金港】1039 Course List for Student 字符串转int映射
A 1039 Course List for Student题目链接Problem DescriptionZhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered course list for each student who comes原创 2021-02-01 00:01:04 · 61 阅读 · 0 评论 -
【剑指紫金港】1038 Recover the Smallest Number 玄学
A 1038 Recover the Smallest Number(CMP函数的玄学运用)题目链接Problem DescriptionGiven a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we can recover many numbers such like原创 2021-01-31 23:18:08 · 62 阅读 · 0 评论 -
【剑指紫金港】1033 To Fill or Not to Fill 贪心
A 1033 To Fill or Not to Fill(官网+牛客全AC)题目链接Problem DescriptionWith highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Dif原创 2021-01-31 11:43:49 · 86 阅读 · 1 评论 -
【剑指紫金港】1030 Travel Plan Dijsktra+路径筛选记录
A 1030 Travel Plan(模板题)题目链接Problem DescriptionA 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 between原创 2021-01-30 13:30:23 · 73 阅读 · 0 评论 -
【剑指紫金港】1026 Table Tennis 模拟题的天花板
A 1026 Table Tennis(PAT官网+牛客网全AC)题目链接Problem DescriptionA table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if there are some tables open when they arrive, they will be assigned to the原创 2021-01-29 22:51:52 · 87 阅读 · 0 评论 -
【剑指紫金港】1022 Digital Library 模拟信息查询
A 1022 Digital Library题目链接Problem DescriptionA 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原创 2021-01-28 17:25:15 · 77 阅读 · 0 评论 -
【剑指紫金港】1151 LCA in a Binary Tree 最近公共祖先&DFS
A 1151 LCA in a Binary Tree题目链接Problem DescriptionThe lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.Given any two nodes in a binary tree, you are supposed to find their LCA.InputE原创 2021-01-27 23:44:15 · 60 阅读 · 0 评论 -
【剑指紫金港】1014 Waiting in Line 排队模拟
A 1014 Waiting in Line题目链接Problem DescriptionSuppose 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 inside t原创 2021-01-27 21:38:13 · 128 阅读 · 0 评论 -
【剑指紫金港】1017 Queueing at Bank 排队模拟
A 1017 Queueing at Bank题目链接Problem DescriptionSuppose 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 line, unt原创 2021-01-27 13:29:00 · 63 阅读 · 0 评论 -
【剑指紫金港】1153 Decode Registration Card of PAT
A 1153 Decode Registration Card of PAT题目链接Problem DescriptionA registration card number of PAT consists of 4 parts:the 1st letter represents the test level, namely,Tfor the top level, Afor advance and Bfor basic;the 2nd - 4th digits are the test site原创 2021-01-25 23:23:00 · 92 阅读 · 0 评论 -
【剑指紫金港】1095 Cars on Campus 模拟
A 1095 Cars on Campus题目链接Problem DescriptionInputOutputSample Input:ASample Output:2题目大意:牛解题思路:龙AC代码#include <bits/stdc++.h>using namespace std;#define max(a, b) ((a) > (b) ? (a) : (b))#define INF 0x3f3f3f3ftypedef long long ll原创 2021-01-14 22:30:12 · 55 阅读 · 0 评论 -
【剑指紫金港】1091 Acute Stroke 英语词汇&BFS
A 1091 Acute Stroke题目链接Problem DescriptionOne important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MRI slice, your job is to calculate th原创 2021-01-12 21:38:57 · 90 阅读 · 0 评论