自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

lilian的博客

快乐学习!

  • 博客(154)
  • 收藏
  • 关注

原创 进程与线程

进程与线程进程线程进程进程是一个运行的程序的实例,有关进程的相关信息(如进程状态、程序计数器、CPU寄存器、CPU调度信息、内存界限、文件描述符等)都封装在一个叫做PCB(进程控制块)的数据结构中。该数据结构不属于进程,而属于操作系统内核。作业队列中在进行排队等待调度的不是进程,而是进程的PCB,这个队列通常用链表来实现,其头节点指向链表的第一个和最后一个PCB块的指针。每个PCB包括一个指向就绪队列的下一个PCB的指针域。与进程有关的APIforkwaitexit线程线程是

2020-09-09 21:47:04 318

原创 PAT A1087:All Roads Lead to Rome之Dijkstra

题目描述1087 All Roads Lead to Rome (30分)Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happiness.Input Specification:Each input file contains

2020-07-20 13:01:58 310

原创 PAT A1088:Rational Arithmetic

题目描述1088 Rational Arithmetic (20分)For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Specification:Each input file contains one test case, which gives in on

2020-06-28 09:53:35 305

原创 PAT A1080:Graduate Admission之sort排序

题目描述1080 Graduate Admission (30分)It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admission procedure.Each appl

2020-06-27 17:47:01 250

原创 PAT A1063:Set Similarity

题目描述1063 Set Similarity (25分)Given two sets of integers, the similarity of the sets is defined to be Nc/Nt×100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the total number of distinct numbers in the two sets. You

2020-06-27 12:06:01 186

原创 PAT A1062:Talent and Virtue之排序策略

题目描述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(圣人)

2020-06-27 10:34:02 298

原创 PAT A1058:A+B in Hogwarts

1058 A+B in Hogwarts (20分)If you are a fan of Harry Potter, you would know the world of magic has its own currency system – as Hagrid explained it to Harry, “Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Sickle, it’s easy enough.” Your

2020-06-25 20:01:24 202

原创 PAT A1057:Stack之栈模拟

题目描述1057 Stack (30分)Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and Pop (deleting the top element). Now

2020-06-22 08:33:15 290

原创 PAT A1056:Mice and Rice之队列模拟

题目描述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 b

2020-06-17 11:17:03 187

原创 PAT A1055:The Worlds Richest之sort排序

题目描述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

2020-06-14 15:45:49 208

原创 PAT A1054:The Dominant Color之map求解

题目描述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 stri

2020-06-14 09:22:02 152

原创 PAT A1096:Consecutive Factors

题目描述1096 Consecutive Factors (20分)Among 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 positive N, you

2020-06-11 10:19:35 177

原创 PAT A1100:Mars Numbers

题目描述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 Earth is called “jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec” on Mars, respectively.For the next high

2020-06-11 09:48:10 172

原创 PAT A1082:Read Number in Chinese

题目描述1082 Read Number in Chinese (25分)Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fu first if it is negative. For example, -123456789 is read as Fu yi Yi er Qian san Bai si Shi wu Wan liu

2020-06-01 21:13:24 151

原创 PAT A1089:Insert or Merge之插入和归并排序

题目描述1089 Insert or Merge (25分)According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, finds the location it be

2020-06-01 10:30:10 179

原创 PAT A1115:Counting Nodes in a BST之搜索二叉树建树

题目描述1115 Counting Nodes in a BST (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 or equal to the node’s key.The right subtree o

2020-05-31 19:28:31 172

原创 PAT A1138:Postorder Traversal之前序和中序遍历建树

题目描述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 number of the postorder traversal sequence of the corres

2020-05-31 18:34:37 231

原创 PAT A1119:Pre- and Post-order Traversals之前序、后序遍历序列建树

题目描述1119 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 and inorder traversal

2020-05-31 16:36:26 227

原创 PAT A1086:Tree Traversals Again之前序和中序遍历建树&栈模拟建树过程

题目描述1086 Tree Traversals Again (25分)An 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 operations are:

2020-05-31 13:37:21 204

原创 PAT A1099:Build A Binary Search Tree之中序遍历建树

题目描述1099 Build A 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

2020-05-31 09:19:39 316 1

原创 PAT A1092:To Buy or Not to Buy之哈希映射

题目描述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 owner of the shop would only sell the strings in wh

2020-05-30 18:32:06 127

原创 PAT A1081:Rational Sum之分数加法

题目描述1081 Rational Sum (20分)Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts with a positive integer N (≤100), followed in th

2020-05-30 17:29:43 206

原创 PAT A1083:List Grades之排序

题目描述1083 List Grades (25分)Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of which the grades are in a given interval.Inp

2020-05-29 20:38:24 151

原创 PAT A1074:Reversing Linked List之静态链表排序

题目描述1074 Reversing Linked List (25分)Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L.For example, given L being 1→2→3→4→5→6, if K=3, then you must output 3→2→1→6→5→4; if K=4, you must output 4

2020-05-29 20:18:55 190

原创 PAT A061:Dating

题目描述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 those strange strings are actually referring to the co

2020-05-28 11:39:58 310

原创 PAT A1064:Complete Binary Search Tree之完全二叉搜索树

题目描述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

2020-05-28 10:20:08 211

原创 PAT 1068:Find More Coins之动态规划求解

题目描述1068 Find More Coins (30分)Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However, there was a special req

2020-05-27 19:55:58 257

原创 PAT A1048:Find Coins

题目描述1048 Find Coins (25分)Eva loves to collect coins from all over the universe, including some other planets like Mars.One day she visited a universal shopping mall which could accept all kinds of coins as payments. However, there was a special requirem

2020-05-27 16:52:46 159

原创 PAT A1051:Pop Sequence之栈模拟

题目描述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 i

2020-05-26 21:33:36 341

原创 PAT A1045:Favorite Color Stripe之动态规划

题目描述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 together to form

2020-05-25 21:40:54 126

原创 PAT A1044:Shopping in Mars之二分查找

题目描述1044 Shopping in Mars (25分)Shopping 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 only once and some

2020-05-24 17:49:53 126

原创 PAT A1047:Student List for Course之sort排序

题目描述1047 Student List for Course (25分)Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses.Input Specification:Eac

2020-05-24 15:27:07 168

原创 PAT A1042:Shuffling Machine

题目描述1042 Shuffling Machine (20分)Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid “inside jobs” where employees collaborate with gamblers by performing inadeq

2020-05-23 10:27:18 138

原创 PAT A1040:Longest Symmetric String最长子回文串

题目描述1040 Longest Symmetric String (25分)Given 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, hence you must output 11.

2020-05-23 09:19:26 162

原创 PAT A1039:Course List for Student之哈希

题目描述1039 Course List for Student (25分)Zhejiang 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 for a query.Inp

2020-05-22 11:17:42 130

原创 PAT A1038:Recover the Smallest Number之sort排序

题目描述1038 Recover the Smallest Number (30分)Given 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 32-321-3214-0229-87 or 0229-

2020-05-22 08:27:06 124

原创 PAT A1037:Magic Coupon

题目描述1037 Magic Coupon (25分)The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times the value of that product back! What is more, the shop

2020-05-21 18:38:33 131

原创 PAT A1036:Boys vs Girls之sort排序

题目描述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 test case. Each case contains

2020-05-21 17:35:29 120

原创 PAT A1050:String Subtraction之哈希映射

题目描述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

2020-05-20 20:52:09 190

原创 PAT A1035:Password

题目描述1035 Password (20分)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 in lowercase), or 0 (zero) from

2020-05-20 20:23:22 114

空空如也

空空如也

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

TA关注的人

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