自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 1084 Broken Keyboard (20 分)

1084 Broken Keyboard (20 分)On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a string that you are supposed to type, and the string that yo

2021-10-11 16:13:05 129

原创 1050 String Subtraction (20 分)

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 d

2021-10-11 15:57:17 128

原创 1051 Pop Sequence (25 分)

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

2021-10-11 15:25:24 156

原创 1048 Find Coins (25 分)并未AC

1048 Find Coins (25 分)并未ACEva 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

2021-10-04 21:16:43 122

原创 1041 Be Unique (20 分)

1041 Be Unique (20 分)Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,104]. The first one who bets on a unique number wins. For example,

2021-10-04 20:58:05 96

原创 1047 Student List for Course (25 分)

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:Each in

2021-10-04 20:41:04 65

原创 1039 Course List for Student (25 分)

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

2021-10-04 20:06:47 109

原创 1032 Sharing (25 分)

1032 Sharing (25 分)To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example, loading and being are stored as sho

2021-10-03 17:40:56 77

原创 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 Specification:Each input file contains one test case. For each

2021-10-03 10:17:42 65

原创 1042 Shuffling Machine (20 分)

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 inadequate

2021-10-02 23:24:44 71

原创 1009 Product of Polynomials (25 分)

1009 Product of Polynomials (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 lines, and each line contains the information of a polynomial:K

2021-10-02 22:56:38 89

原创 1152 Google Recruitment (20 分)

1152 Google Recruitment (20 分)In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for recruitment. The content is super-simple, a URL consisting of the first 10-digit prime found in consecutive

2021-10-02 16:04:40 97

原创 1140 Look-and-say Sequence (20 分)

1140 Look-and-say Sequence (20 分)Look-and-say sequence is a sequence of integers as the following:D, D1, D111, D113, D11231, D112213111, ...where D is in [0, 9] except 1. The (n+1)st number is a kind of description of the nth number. For example, the 2

2021-10-02 15:43:17 99

原创 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 legal. A legal input is a real number in [−1000,1000] and

2021-10-02 15:26:25 80

原创 1082 Read Number in Chinese (25 分)

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 Qia

2021-09-30 14:42:10 83

原创 1073 Scientific Notation (20 分)

1073 Scientific Notation (20 分)Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [±][1-9].[0-9]+E[±][0-9]+ which means that the integer portion has exactly on

2021-09-30 14:10:32 78

原创 1035 Password (20 分)

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 O (

2021-09-29 20:53:32 77

原创 1005 Spell It Right (20 分)

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

2021-09-29 20:31:13 67

原创 1001 A+B Format (20 分)

1001 A+B Format (20 分)Calculate a+b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Specification:Each input file contains one test case. Each ca

2021-09-29 20:22:05 85

原创 1115 Counting Nodes in a BST (30 分)

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 of

2021-09-29 20:19:48 103 1

原创 1090 Highest Price in Supply Chain (25 分)

1090 Highest Price in Supply Chain (25 分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the chain buys pr

2021-09-29 18:48:21 71

原创 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 fuck off.Now it’s your turn to prove that YOU CAN invert

2021-09-28 20:36:08 81

原创 1086 Tree Traversals Again (25 分)

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: push

2021-09-28 16:48:45 70

原创 1146 Shortest Distance (20 分)

1146 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 Specification:Each input file contains one test case. For each

2021-09-28 15:37:06 66

原创 1125 Chain the Ropes (25 分)

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 chain will be treated as another

2021-09-27 16:40:21 88

原创 1113 Integer Set Partition (25 分)

1113 Integer Set Partition (25 分)Given a set of N (>1) positive integers, you are supposed to partition them into two disjoint sets A1 and A2 of n1 and n2 numbers, respectively. Let S1 and S2 denote the sums of all the numbers in A1 and A2, respectivel

2021-09-27 16:20:27 67

原创 1101 Quick Sort (25 分)

1101 Quick Sort (25 分)There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pivot are moved to its left and those larger than the pivo

2021-09-27 11:28:18 91

原创 PAT甲级做题记录

这次我一定会完成!!!!题目链接1012 The Best Rank (25 分)1012 The Best Rank (25 分)1025 PAT Ranking (25 分)1025 PAT Ranking (25 分)1028 List Sorting (25 分)1028 List Sorting (25 分)1053 Path of Equal Weight (30 分)1053 Path of Equal Weight (30 分)1055

2021-09-27 10:56:26 136

原创 1053 Path of Equal Weight (30 分)

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 g

2021-09-27 10:37:39 81

原创 1083 List Grades (25 分)

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

2021-09-25 20:13:53 279

原创 1055 The World‘s Richest (25 分)

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

2021-09-25 17:05:10 283

原创 1028 List Sorting (25 分)

1028 List Sorting (25 分)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 integers N (≤105) and C, where N

2021-09-25 16:37:47 70

原创 1025 PAT Ranking (25 分)

1025 PAT Ranking (25 分)Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists will be merged immediately after

2021-09-25 15:58:41 179

原创 1012 The Best Rank (25 分)

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 enc

2021-09-25 15:13:06 260

原创 7-10 公路村村通 (30 分)

7-10 公路村村通 (30 分)现有村落间道路的统计数据表中,列出了有可能建设成标准公路的若干条道路的成本,求使每个村落都有公路连通所需要的最低成本。输入格式:输入数据包括城镇数目正整数N(≤1000)和候选道路数目M(≤3N);随后的M行对应M条道路,每行给出3个正整数,分别是该条道路直接连通的两个城镇的编号以及该道路改建的预算成本。为简单起见,城镇从1到N编号。输出格式:输出村村通需要的最低成本。如果输入数据不足以保证畅通,则输出−1,表示需要建设更多公路。输入样例:6 151 2 5

2021-02-03 15:21:27 175

原创 7-9 旅游规划 (25分)

7-9 旅游规划 (25分)有了一张自驾旅游路线图,你会知道城市间的高速公路长度、以及该公路要收取的过路费。现在需要你写一个程序,帮助前来咨询的游客找一条出发地和目的地之间的最短路径。如果有若干条路径都是最短的,那么需要输出最便宜的一条路径。输入格式:输入说明:输入数据的第1行给出4个正整数N、M、S、D,其中N(2≤N≤500)是城市的个数,顺便假设城市的编号为0~(N−1);M是高速公路的条数;S是出发地的城市编号;D是目的地的城市编号。随后的M行中,每行给出一条高速公路的信息,分别是:城市1、城

2021-02-02 12:41:13 252

原创 7-52 两个有序链表序列的交集 (20分)

7-52 两个有序链表序列的交集 (20分)已知两个非降序链表序列S1与S2,设计函数构造出S1与S2的交集新链表S3。输入格式:输入分两行,分别在每行给出由若干个正整数构成的非降序序列,用−1表示序列的结尾(−1不属于这个序列)。数字用空格间隔。输出格式:在一行中输出两个输入序列的交集序列,数字间用空格分开,结尾不能有多余空格;若新链表为空,输出NULL。输入样例:1 2 5 -12 4 5 8 10 -1输出样例:2 5代码实现(C语言)#include <stdio.

2021-02-02 00:34:50 333

原创 7-13 统计工龄 (20分)

7-13 统计工龄 (20分)给定公司N名员工的工龄,要求按工龄增序输出每个工龄段有多少员工。输入格式:输入首先给出正整数N(≤10510^5105),即员工总人数;随后给出N个整数,即每个员工的工龄,范围在[0, 50]。输出格式:按工龄的递增顺序输出每个工龄的员工个数,格式为:“工龄:人数”。每项占一行。如果人数为0则不输出该项。输入样例:810 2 0 5 7 2 5 2输出样例:0:12:35:27:110:1代码实现(C语言)这道题将年龄范围限定在{0 : 50

2021-01-29 02:12:33 342

原创 7-12 排序 (25分)

7-12 排序 (25分)给定N个(长整型范围内的)整数,要求输出从小到大排序后的结果。本题旨在测试各种不同的排序算法在各种数据情况下的表现。各组测试数据特点如下:数据1:只有1个元素;数据2:11个不相同的整数,测试基本正确性;数据3:10310^3103个随机整数;数据4:10410^4104个随机整数;数据5:10510^5105个随机整数;数据6:10510^5105个顺序整数;数据7:10510^5105个逆序整数;数据8:10510^5105个基本有序的整数;数据9:105

2021-01-29 02:04:44 275

原创 7-5 堆中的路径 (25分)

7-5 堆中的路径 (25分)将一系列给定数字插入一个初始为空的小顶堆H[]。随后对任意给定的下标i,打印从H[i]到根结点的路径。输入格式:每组测试第1行包含2个正整数N和M(≤1000),分别是插入元素的个数、以及需要打印的路径条数。下一行给出区间[-10000, 10000]内的N个要被插入一个初始为空的小顶堆的整数。最后一行给出M个下标。输出格式:对输入中给出的每个下标i,在一行中输出从H[i]到根结点的路径上的数据。数字间以1个空格分隔,行末不得有多余空格。输入样例:5 346 2

2021-01-28 15:16:29 209

空空如也

空空如也

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

TA关注的人

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