自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 1021 Deepest Root (25 分) 并查集+dfs邻接表

1021Deepest 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 ...

2019-11-27 19:51:10 202

原创 1087 All Roads Lead to Rome (30 分) djkstra+DFS 1-n-1 ,0为起点

1087All 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 hap...

2019-11-26 11:33:45 162

原创 1018 Public Bike Management (30 分) djkstra+dfs 顶点坐标从1到n

1018Public Bike Management(30分)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 at any station and ret...

2019-11-25 21:22:22 243

原创 1072 Gas Station (30 分) dijkstra +字符转换

1072Gas Station(30分)A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must g...

2019-11-25 20:36:07 173

原创 1030 Travel Plan (30 分) 求最短路径以及最短距离和最小花费

1030Travel 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 d...

2019-11-25 19:23:33 176

原创 1003 Emergency (25 分) dfs+dijkstra

1003Emergency(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...

2019-11-25 00:42:47 741

原创 1013 Battle Over Cities (25 分) 图的遍历DFS的邻接表法

1013Battle 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...

2019-11-20 19:44:52 149

原创 1076 Forwards on Weibo (30 分) 图的遍历 /BFS邻接表版

1076Forwards 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 wi...

2019-11-20 18:55:47 96

原创 1076 Forwards on Weibo (30 分)

1076Forwards 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 wi...

2019-11-20 18:53:29 135

原创 1034 Head of a Gang (30 分) 图的遍历DFS 邻接矩阵版

1034Head 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...

2019-11-20 17:50:50 155

原创 1098 Insertion or Heap Sort (25 分)

1098Insertion or Heap Sort(25分)According to Wikipedia:Insertion sortiterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort remo...

2019-11-19 19:03:42 603

原创 1107 Social Clusters (30 分)并查集

1107Social 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...

2019-11-17 19:25:19 112

原创 1099 Build A Binary Search Tree (30 分)二叉查询树的构造利用中序遍历

1099Build 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...

2019-11-17 16:34:46 146

原创 1064 Complete Binary Search Tree (30 分) 完全二叉查找树,用数组存放完全二叉树,用中序遍历构造二叉查找树

1064Complete 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 key...

2019-11-17 16:08:55 209

原创 1043 Is It a Binary Search Tree (25 分) BST反转?不反转 遍历+vector

1043Is It a Binary Search Tree(25分)与A1102好好对比,都是反转树A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains on...

2019-11-16 22:22:21 239

原创 1004 Counting Leaves (30 分) DFS+vector

1004Counting 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 on...

2019-11-15 20:40:15 591

原创 1106 Lowest Price in Supply Chain (25 分) 静态树vector+DFS

1106Lowest 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.Start...

2019-11-15 20:03:55 111

原创 1094 The Largest Generation (25 分) 静态的树的写法vector<int> Node[maxn]+DFS

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

2019-11-15 19:46:48 135

原创 1079 Total Sales of Supply Chain (25 分) 树的遍历:DFS+vector

1079Total 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.Starti...

2019-11-15 19:19:33 142

原创 1090 Highest Price in Supply Chain (25 分) 树的遍历:深度搜索+vector

返回1090Highest 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....

2019-11-15 18:29:51 129

原创 102 Invert a Binary Tree (25 分)二叉树的静态写法,静态层序,前序,后序

1102Invert 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...

2019-11-13 21:38:03 166

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

2019-11-13 17:29:19 132

原创 1053 Path of Equal Weight (30 分)一般树的遍历 DFS+vector容器+sort排序

1053Path of Equal Weight(30分)Given a non-empty tree with rootR, and with weightW​i​​assigned to each tree nodeT​i​​. Theweight of a path fromRtoLis defined to be the sum of the weights o...

2019-11-13 16:39:24 143

原创 1020 Tree Traversals (25 分)给中后序写层序

1020Tree Traversals(25分)Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order ...

2019-11-12 11:33:46 125

原创 1091 Acute Stroke (30 分)广度优先搜索,用queue,重写一遍

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

2019-11-11 17:49:25 100

原创 1103 Integer Factorization (30 分)深度搜索30分大题要重写

1103Integer Factorization(30分)注意每个因子是可以重选的,所以在选择的情况下下一层仍然是indexTheK−Pfactorization of a positive integerNis to writeNas the sum of theP-th power ofKpositive integers. You are supposed ...

2019-11-10 16:38:55 168

原创 1097 Deduplication on a Linked List (25 分)静态链表

1097Deduplication on a Linked List(25分)Given a singly linked listLwith integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each valueK,...

2019-11-07 22:59:02 98

原创 1074 Reversing Linked List (25 分)

1074Reversing Linked List(25分)Given a constantKand a singly linked listL, you are supposed to reverse the links of everyKelements onL. For example, givenLbeing 1→2→3→4→5→6, ifK=3, then y...

2019-11-07 11:03:00 113

原创 1056 Mice and Rice (25 分) queue

1056Mice and Rice(25分)Mice and Riceis 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 m...

2019-11-07 00:35:12 121

原创 1051 Pop Sequence (25 分) stack,注意pop前一定要判空,并且最后确定栈内被pop空了

1051Pop Sequence(25分)Given a stack which can keepMnumbers at most. PushNnumbers in the order of 1, 2, 3, ...,Nand pop randomly. You are supposed to tell if a given sequence of numbers is a ...

2019-11-05 23:53:32 138

原创 1063 Set Similarity (25 分) set注意查询从1到q所以输入的时候也要从1到n

1063Set Similarity(25分)Given two sets of integers, the similarity of the sets is defined to beN​c​​/N​t​​×100%, whereN​c​​is the number of distinct common numbers shared by the two sets, andN...

2019-11-05 14:35:08 118

原创 1052 Linked List Sorting (25 分)静态链表+按data排序

#include <cstdio>#include <algorithm>using namespace std;const int maxn = 100010;struct Node { int data, next, address; bool flag;}node[maxn];bool cmp(Node a, Node b) { if (a.fl...

2019-11-05 11:28:57 136

原创 1032 Sharing (25 分)静态链表

1032Sharing(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...

2019-11-04 20:32:11 88

原创 1047 Student List for Course (25 分) vector+sort

1047Student 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 na...

2019-11-03 19:58:45 99

原创 1039 Course List for Student (25 分)

1039Course 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 co...

2019-11-02 13:26:04 106

原创 1060 Are They Equal (25 分)科学计数法,stl中string的各种函数用法

1060Are They Equal(25分)If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as0.123×10​5​​with simple chopping. Now...

2019-10-30 20:39:52 124

原创 有关C++的标准模板库(STL)的一些个人易错点

1.有关set的find()函数#include <cstdio>#include <set>using namespace std;int main() { set<int>st; for (int i = 1; i <= 3; i++) { st.insert(i); } set<int>::iterator it...

2019-10-30 18:40:32 189

原创 1024 Palindromic Number (25 分)大整数相加+会问+reverse倒置

返回1024Palindromic Number(25分)A number that will be the same when it is written forwards or backwards is known as aPalindromic Number. For example, 1234321 is a palindromic number. All single d...

2019-10-03 16:46:23 99

原创 1023 Have Fun with Numbers (20 分大整数计算

1023Have Fun with Numbers(20分)Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happe...

2019-10-03 15:52:28 410

原创 1059 Prime Factors (25 分)质因子 易错题

1059Prime Factors(25分)Given any positive integerN, you are supposed to find all of its prime factors, and write them in the formatN=p​1​​​k​1​​​​×p​2​​​k​2​​​​×⋯×p​m​​​k​m​​​​.Input Specifi...

2019-10-02 20:31:34 148

空空如也

空空如也

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

TA关注的人

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