自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 vector的一些实用函数

vector的一些实用函数

2023-02-19 14:54:43 150

原创 c++ debug

==42==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000001c0 at pc 0x00000034bd79 bp 0x7fffd558d960 sp 0x7fffd558d958

2023-02-16 21:36:31 176

原创 map的一些访问

map的访问

2023-02-15 15:03:07 159

原创 pat1141 PAT Ranking of Institutions (排序)

1141 PAT Ranking of Institutions (25 分)After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist.Input Specification:Each input file contains one..

2022-03-03 23:31:01 63

原创 pat1133 Splitting A Linked List (静态链表 vector)

1133 Splitting A Linked List (25 分)Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before all of the non-negatives, and all the values in [0, K] appear before all those greater than K. The ord

2022-03-03 17:20:12 165

原创 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 correspon

2022-03-03 15:52:32 427

原创 a1127 ZigZagging on a Tree (中序,后序 -> 层序)

1127 ZigZagging on a Tree (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. And it is a simple standard routine to print t

2022-03-02 21:16:51 243

原创 1115 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

2022-03-02 14:28:51 89

原创 a1121 Damn Single (set)

1121 Damn Single (25 分)"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of.Input Specification:Each input file contains one tes..

2022-03-02 14:28:31 46

原创 a1120 Friend Numbers (set)

1120 Friend Numbers (20 分)Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are friend numbers since 1+2+3 = 5+1 = 6, and 6 is their friend ID. Given some number

2022-03-02 13:00:08 60

原创 a1118 Birds in Forest(并查集,set)

1118 Birds in Forest (25 分)Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree. You are supposed to help the scientists to count the maximum number of trees in the

2022-03-02 12:30:44 54

原创 a1117 Eddington Number

1117 Eddington Number (25 分)British 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 integerEsuch that it is forEdays that one rides more t...

2022-03-02 00:59:14 64

原创 1113 Integer Set Partition (sort排序)

1113 Integer Set Partition (25 分)Given a set ofN(>1) positive integers, you are supposed to partition them into two disjoint setsA1​andA2​ofn1​andn2​numbers, respectively. LetS1​andS2​denote the sums of all the numbers inA1​...

2022-03-01 22:05:34 93

原创 a1111 Online Map(dijkstra + dfs)

1111 Online Map (30 分)Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other is the fastest. It is guaranteed that a pat..

2022-03-01 21:13:47 135

原创 a1039 Course List for Student (map)

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 q..

2022-03-01 15:16:14 55

原创 a1036 Boys vs Girls

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

2022-03-01 15:09:00 50

原创 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 distinguish1(one) froml(Lin lowercase), or0(zero) fromO...

2022-03-01 12:09:25 43

原创 a1032 Sharing (静态链表)

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,loadingandbeingare stored as sh...

2022-03-01 02:17:39 83

原创 a1030 Travel Plan (dijkstra + dfs)

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 between his/her starting city an

2022-03-01 01:49:33 141

原创 a1029 Median(vector的使用)

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 15. The median of two sequences is

2022-03-01 01:10:36 70

原创 1025 PAT Ranking (排序)

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

2022-03-01 00:57:43 90

原创 a1011 World Cup Betting (找最大值)

1011 World Cup Betting (20 分)With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly, football betting

2022-02-28 17:05:07 40

原创 a1008 Elevator

1008 Elevator (20 分)The highest building in our city has only one elevator. A request list is made up withNpositive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one f..

2022-02-28 16:30:38 74

原创 a1006 Sign In and Sign Out (时间换算)

1006 Sign In and Sign Out (25 分)At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you are supposed to find

2022-02-28 16:11:37 121

原创 a1005 Spell It Right (string应用)

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 whi

2022-02-28 15:55:58 58

原创 a1004 Counting Leaves (DFS)

1004 Counting Leaves (30 分)A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file contains one test case. Each case starts with a line containing0&l.

2022-02-28 15:42:06 58

原创 a1003 Emergency (dijkstra + dfs)

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 pa

2022-02-28 15:40:12 65

原创 a1076 Forwards on Weibo (DFS、BFS)

1076 Forwards on Weibo (30 分)Weibo 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 makes a post on Weib

2022-02-27 20:53:57 81

原创 a1021 Deepest Root (图的遍历、DFS)

1021 Deepest Root (25 分)A graph which is connected and acyclic can be considered a tree. The height 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 is calledthe deepest root.I.

2022-02-27 15:56:24 181

原创 a1013 Battle Over Cities (图的遍历 DFS)

1013 Battle Over Cities (25 分)It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we need to repair any other hi

2022-02-27 14:41:17 139

原创 1076 Forwards on Weibo(BFS)

1076 Forwards on Weibo (30 分)Weibo 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 makes a post on Weib

2022-02-26 20:38:51 231

原创 a1034 Head of a Gang (DFS、并查集)

1034 Head of a Gang (30 分)One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call betweenAandB, we say thatAandBis related. The weight of a relation is defined to be the total time length of all ...

2022-02-26 18:59:47 139

原创 pat1107 Social Clusters 并查集

1107 Social Clusters (30 分)When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. Asocial clusteris a set of people who have some of their hobbies in common. You ar..

2022-02-26 13:11:05 75

原创 1099 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

2022-02-25 23:53:24 416

原创 pat1064 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 n...

2022-02-25 22:48:00 155

原创 pat1053Path of Equal Weight (DFS)

1053 Path of Equal Weight (30 分)Given a non-empty tree with rootR, and with weightWi​assigned to each tree nodeTi​. Theweight of a path fromRtoLis defined to be the sum of the weights of all the nodes along the path fromRto any leaf nodeL.N...

2022-02-25 19:12:52 173

原创 pat1094 The Largest Generation (DFS、BFS)

1094 The Largest Generation (25 分)A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population.Input Specification:Each

2022-02-25 16:40:20 120

原创 pat1106 Lowest Price in Supply Chain (DFS)

1106 Lowest 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 p

2022-02-25 15:18:09 50

原创 pat1079 Total Sales of Supply Chain (DFS)

1079 Total Sales of 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

2022-02-25 14:30:48 43

原创 pat1090 Highest Price in Supply Chain (DFS)

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

2022-02-25 13:59:47 55

空空如也

空空如也

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

TA关注的人

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