自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Star's blogs

你的身前有千军万马,身后亦然

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

原创 一步彻底解决vscode高亮慢的问题

一部彻底解决vscode高亮慢的问题!

2022-05-11 16:35:31 1052 1

原创 word文档中的页码问题

word中烦死人的页码设置!一帖迅速搞定!

2022-05-11 16:29:54 2168

原创 dp——01背包,分组背包,完全背包

1. 01背包有N 件物品和一个容量为V 的背包。放入第i 件物品耗费的空间 是vi,得到的价值是wi。求解将哪些物品装入背包可使价值总和最大。根据题意,我们便可以设dp[i][j]为已经装了i件物品且最大容量为j得最大价值.此时,我们就可以枚举i和j进行动态规划的状态转移得到结论.那么dp[i][j]的最大价值是怎么转移的呢?当第i件物品不选的时候,相当于前i件物品相同的体积j的最大价...

2021-07-07 09:12:49 174

原创 2019年秋PAT总结

总览判断,偶尔看看题榜,决定做题顺序。一定要认真审题,注意细节,比如no的时候输出什么……思路清晰再下笔。很烂的结果,往往隐藏着最正确的答案。王瑜最棒!7-1 Forever 未作答 得分: 0 / 20"Forever number" is a positive integer A with K digits, satisfying the followi...

2019-12-07 10:39:44 115

原创 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 gamble...

2019-12-01 10:19:33 84

原创 1017 Queueing at Bank (25 分)

Suppose 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 l...

2019-11-30 17:03:01 63

原创 1014 Waiting in Line (30 分)

Suppose a bank has NNN 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 sp...

2019-11-30 12:16:06 42

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

2019-11-27 14:13:31 51

原创 1044 Shopping in Mars (25 分)

题意:求一串的数字中连续的一段,使得这个连续的段内数字的和恰好等于所期望的值m。如果不能找到恰好等于,就找让自己付出最少的价格(总和必须大于等于所给值)的那段区间。求所有可能的结果。分析:简单模拟有两个超时。后来想到因为sum数组是递增的,所以改用二分法查找~子函数的作用是二分查找,修改tempans和j的值~一开始接收输入的时候可以直接保存它的sum函数,即sum[i]表示1~i的所有数字的...

2019-11-27 13:39:04 57

原创 1010 Radix (25 分)

Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number.Now for any pair of positive int...

2019-11-25 21:19:31 46

原创 1095 Cars on Campus (30 分)(排序)

Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the information available, you ...

2019-11-25 09:04:09 54

原创 1123 Is It a Complete AVL Tree (30 分)

An 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 i...

2019-11-24 21:18:24 61

原创 1127 ZigZagging on a Tree (30 分) (Z字形层序输出二叉树)

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

2019-11-24 17:59:04 68

原创 1135 Is It A Red-Black Tree (30 分)()

There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:(1) Every node is either red or black. (2) The root is black. (3) Ever...

2019-11-23 20:58:59 55

原创 1139 First Contact(30 分)

Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. When a boy A had a crush on a girl B, he would usually not contact her directly ...

2019-11-23 12:23:49 398

原创 1151 LCA in a Binary Tree (30 分)&1147 Heaps (30 分) &1143 Lowest Common Ancestor (30 分)&(二叉树、堆的判断)

The 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.I...

2019-11-23 07:38:49 48

原创 1056 Mice and Rice (25 分)(queue的用法)

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

2019-11-22 16:40:31 52

原创 1098 Insertion or Heap Sort (25 分) (堆排序和插入排序的特征)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...

2019-11-21 19:00:14 62

原创 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 } i...

2019-11-21 11:24:18 59

原创 1078 Hashing (25 分)(平方探测法)

The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined to be H(key)=key%TSi...

2019-11-21 10:34:24 73

原创 1110 Complete Binary Tree (25 分)(完全二叉树)

Given a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains one test case. For each case, the first line gives a positive integer N (≤20) w...

2019-11-20 09:36:22 137

原创 1122 Hamiltonian Cycle (25 分)(哈密尔顿路径的判断)

The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle".In this problem, you are supposed to tell if a given cycle...

2019-11-20 07:32:09 421

原创 1134 Vertex Cover (25 分)(无向图计算——最小顶点覆盖)

A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of the set. Now given a graph with several vertex sets, you are supposed to tell if ...

2019-11-18 21:44:28 241

原创 PAT树专题

1.已知后序和中序,求层序输出——利用两序建树,后bfs输出树上结点值例题 PAT甲 1020 Tree Traversals (25 分)https://pintia.cn/problem-sets/994805342720868352/problems/994805485033603072int pos[35],in[35];node* root=build(0,n-1,0,n...

2019-11-18 20:38:27 161

原创 1142 Maximal Clique (25 分)(部分完全图/最大部分完全图)

A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique that cannot be extended by including one more ad...

2019-11-18 19:12:05 83

原创 1146 Topological Order (25 分)(拓扑图)

This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are supposed to write a program to test...

2019-11-18 13:16:34 67

原创 1150 Travelling Salesman Problem (25 分)

The "travelling salesman problem" asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city and ret...

2019-11-18 11:06:08 32

原创 PAT甲级真题目录(按题型整理)

最短路径1003. Emergency (25)-PAT甲级真题(Dijkstra算法)1018. Public Bike Management (30)-PAT甲级真题(Dijkstra + DFS)1030. Travel Plan (30)-PAT甲级真题(Dijkstra + DFS,输出路径,边权)1087. All Roads Lead to Rome (30)-PAT甲级真题-Di...

2019-10-07 17:08:49 178

原创 PAT甲——哈希专题

1048 Find Coins (25 分)https://pintia.cn/problem-sets/994805342720868352/problems/994805432256675840题意:n个硬币,给出它们的面值,问是否存在两个硬币是他们的值等于m,若存在输出最小v1、v2,若不存在输出“No Solution”。思路:用cnt【i】记录面值为i的硬币个数。从1到m-1...

2019-10-07 17:08:21 67

原创 PAT甲——排序专题

1012 The Best Rank (25 分)https://pintia.cn/problem-sets/994805342720868352/problems/994805502658068480题意:有n个同学,分别给出他们C语言的成绩C、数学成绩M、英语成绩E。m次询问,若该生不在名单内输出“N/A”,否则输出其单科或平均成绩(A)排名最靠前的名次及科目代号。(排名相同时按优先...

2019-10-06 19:51:49 74

原创 PAT甲级——并查集专题

1107 Social Clusters (30 分)https://pintia.cn/problem-sets/994805342720868352/problems/994805361586847744题意:n个人,每个人有k个爱好,有相同爱好的人是一个社交集合,问有几个社交集合及他们各自的人数。思路:每个人都父节点初值赋为自己,随着输入将该节点与有同样爱好的的根节点合并,最后...

2019-10-04 13:47:41 46

原创 PAT甲级——贪心专题

1033 To Fill or Not to Fill (25 分)https://pintia.cn/problem-sets/994805342720868352/problems/994805458722734080题意:从杭州到某地距离为dis,车辆油罐的最大容量cmax,单位油可行驶的距离davg,共n个加油站,每个加油站给出它的单位油价和距杭州的距离,求到达杭州的最小花费,到不...

2019-10-03 22:07:54 106

原创 PAT甲级——动态规划专题

1007 Maximum Subsequence Sum (25 分)https://pintia.cn/problem-sets/994805342720868352/problems/994805514284679168题意:一共n个数字依次给出,求最大的连续序列和。输出最大和sum及该序列的起止位置。思路:变量有五:当前序列和tmp=0,最大序列和sum=0,当前序列最左元素...

2019-09-15 08:27:16 137

原创 PAT——图专题

1013 Battle Over Cities (25 分)题目:n个城市(1到n),m条路,k个询问的城市,问当某城被攻陷时,若使其它各城连通,至少要修几条路。思路:vis[i]标识该城是否访问,若被攻陷则置为1,遍历1到n,若不为1则dfs——标记,访问与其联通的点,计算连通分量,最少需要修的道路的数量为连通分量-1注意:cin、cout会超时用scanf、printf io...

2019-09-10 17:21:36 77

原创 PAT——最短路径

1018 Public Bike Management (30 分) (Dijkstra+dfs)There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike a...

2019-08-27 10:36:04 216

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

2019-08-26 09:07:30 35

原创 1066 Root of AVL Tree (25 分) (模板)

An 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 i...

2019-08-25 10:46:58 41

原创 1047 Student List for Course && 1039 Course List for Student (25 分)(变长的vector、hash,or map+set)

1047:printf("%s\n",vs[i][j].c_str());//不用%s会超时map+set is okZhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are s...

2019-08-22 15:13:35 43

原创 1022 Digital Library (30 分) (map,set,字符串处理)

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

2019-08-22 12:05:56 42

原创 1091 Acute Stroke (30 分) (三维深搜)

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

2019-08-21 19:06:20 59

空空如也

空空如也

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

TA关注的人

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