
PAT甲级-C/C++
文章平均质量分 82
莓莓不加糖
这个作者很懒,什么都没留下…
展开
-
PAT甲级1005:Spell It Right (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 file contains one test case. Each case occupies one line which contains an N (≤10100).原创 2022-05-13 11:38:51 · 293 阅读 · 0 评论 -
PAT甲级1056: Mice and Rice (25)
题目Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse is to eat as much rice as possible in order to become a FatMouse.First the原创 2022-05-01 22:20:17 · 420 阅读 · 0 评论 -
PAT甲级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 use? For example, to sort {4, 0, 2, 1, 3} we may apply the swap operations in the followi原创 2022-04-26 08:53:21 · 211 阅读 · 0 评论 -
PAT甲级1012:The Best Rank (25)
题目To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - English. At the mean time, we encourage students by emph原创 2022-04-21 23:20:49 · 505 阅读 · 0 评论 -
PAT甲级1064:Complete Binary Search Tree (30)
题目A 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 subtree of a node contains only nodes with keys greater t原创 2022-04-20 10:36:19 · 508 阅读 · 0 评论 -
PAT甲级1062:Talent and Virtue (25)
题目About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people’s talent and virtue. According to his theory, a man being outstanding in both talent and virtue must be a “sage(圣人)”; being less excellent but wit原创 2022-04-19 18:01:08 · 249 阅读 · 0 评论 -
PAT甲级1055:The World‘s Richest (25)
题目Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world’s wealthiest people. Now you are supposed to simulate this job, but concentrate only on the people in a certain range of ages. That is, given the net原创 2022-04-19 17:21:06 · 285 阅读 · 0 评论 -
PAT甲级1054:The Dominant Color (20)
题目Behind the scenes in the computer’s memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the dominant color. A strictly dominant color takes more t原创 2022-04-18 12:51:18 · 241 阅读 · 0 评论 -
PAT甲级1053:Path of Equal Weight (30)
题目Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the path from R to any leaf node L.Now given any weighted tree, you ar原创 2022-04-18 09:42:58 · 262 阅读 · 0 评论 -
PAT甲级1052:Linked List Sorting (25)
题目A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now given a linked list, you are supposed to sort the structu原创 2022-04-15 17:13:03 · 1137 阅读 · 0 评论 -
PAT甲级1051:Pop Sequence (25)
题目Given 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 example, if M is 5 and N is 7, we can obt原创 2022-04-15 14:42:16 · 278 阅读 · 0 评论 -
PAT甲级1050:String Subtraction (20)
题目Given two strings S1 and S2, S = S1−S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1−S2 for any given strings. However, it might not be that simple to do it fast.Input Specifica原创 2022-04-14 20:56:44 · 294 阅读 · 0 评论 -
PAT甲级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, a new number can be obtained by taking the second number from the first one. Repeat in thi原创 2022-04-14 12:59:05 · 213 阅读 · 0 评论 -
PAT甲级1049:Counting Ones (30)
题目The task is simple: given any positive integer N, you are supposed to count the total number of 1’s in the decimal form of the integers from 1 to N. For example, given N being 12, there are five 1’s in 1, 10, 11, and 12.Input Specification:Each input原创 2022-04-13 16:49:19 · 247 阅读 · 0 评论 -
PAT甲级1003:Emergency(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 teams in each city and the length of each road between any pair of cities are mar原创 2022-04-13 09:17:15 · 396 阅读 · 0 评论