自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 L3-3 寻宝路线

题目来源:天梯赛训练题在一个m行n列方格矩阵中,每一个方格内摆放着价值不等的宝贝(价值可正可负),让小明感到好奇的是,从左上角到达右下角的所有可能路线中,能捡到宝贝的价值总和最大是多少?而且这种达到最大值的路线 又有多少条?【注意:只能从一个格子向下或向右走到相邻格子,并且走到的格子宝贝一定会被捡起。】输入格式:第一行为整数m,n(均不大于100),下一行开始会有一个m行n列的整数方阵,对应方格矩阵中的宝贝价值(这些值的绝对值都不超过500)。输出格式:单独一行输出2个整数,分别为能捡到

2022-02-10 13:58:50 359

原创 推荐系统之协同过滤collaborative filtering

皮尔森相关系数余弦相似度推荐系统之协同过滤

2022-01-01 14:01:07 407

原创 分类Classification:决策树Decision Tree

分类的定义决策树Decision Tree混乱衡量指标Gini index决策树的特点

2022-01-01 13:59:26 586

原创 k-means分群

非监督式学习k-means算法的过程分群结果的优劣判断

2022-01-01 13:57:26 486

原创 关联规则ASSOCIATION RULE

先验演算法频繁模式增长法Frequent Pattern-growth:为目前最有效率的关联规则算法。将数据库内ha

2022-01-01 13:56:44 984

原创 快慢指针

题目来源:力扣142. 环形链表 II给定一个链表,返回链表开始入环的第一个节点。 如果链表无环,则返回 null。为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 pos 是 -1,则在该链表中没有环。注意,pos 仅仅是用于标识环的情况,并不会作为参数传递到函数中。说明:不允许修改给定的链表。进阶: 你是否可以使用 O(1) 空间解决此题?示例 1:输入:head = [3,2,0,-4], pos = 1...

2021-10-01 13:40:30 80

原创 二叉树的创建

由完备的先序序列创建二叉树typedef struct bt //二叉树 { int data; struct bt* Lchild; struct bt* Rchild;}TREE,*LPtree;LPtree Node(int data) //创建结点 { LPtree newNode=new TREE; newNode->data=data; newNode->Lchild=NULL; newNode->Rchild=NULL; return newN

2021-09-18 18:15:36 124

原创 L2-2 金字塔游戏

题目来源:天梯赛训练题幼儿园里真热闹,老师带着孩子们做一个名叫金字塔的游戏,游戏规则如下:首先,老师把孩子们按身高从高到矮排列,选出最高的做队长,当金字塔的塔顶,之后在其余小朋友里选出两个最高的,站在队长的前面,队长左右手分别牵着他们的衣服,稍高的在左边,稍矮的在右边。新加入的小朋友依次作为新的队长,继续在其余小朋友里选出高的,按照相同的规则,新队长左右手分别牵着他们的衣服,依次加入到金字塔中。这样下来之后,全幼儿园的小朋友都牵在一起,组成一个大金字塔了。 问题来了,老师想知道两个小朋友之间间隔有多

2021-08-24 20:52:49 513

原创 1154 Vertex Coloring

题目来源:PAT (Advanced Level) PracticeA proper vertex coloring is a labeling of the graph's vertices with colors such that no two vertices sharing the same edge have the same color. A coloring using at most k colors is called a (proper) k-coloring.Now you

2021-08-20 21:40:58 104

原创 1155 Heap Paths

题目来源:PAT (Advanced Level) PracticeIn computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater than or equal to (in a max heap) or les

2021-08-20 20:43:46 83

原创 1116 Come on! Let‘s C

题目来源:PAT (Advanced Level) Practice"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun, the award rules are funny as the following:0、

2021-08-13 11:37:36 121

原创 1110 Complete Binary Tree

题目来源:PAT (Advanced Level) PracticeGiven 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) which is the total num

2021-08-13 10:42:55 108

原创 1108 Finding Average

题目来源:PAT (Advanced Level) PracticeThe 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,10

2021-08-12 17:26:50 140

原创 1075 PAT Judge

题目来源:PAT (Advanced Level) PracticeThe ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Specification:Each input file contains one test case

2021-08-12 16:11:58 128

原创 1078 Hashing

题目来源:PAT (Advanced Level) PracticeThe 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%TSize where TSize is the

2021-08-11 18:59:50 123

原创 1091 Acute Stroke

题目来源:PAT (Advanced Level) PracticeOne 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 to calculate the volume

2021-08-11 17:32:54 93

原创 1088 Rational Arithmetic

题目来源:PAT (Advanced Level) PracticeFor 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

2021-08-11 14:01:20 96

原创 1039 Course List for Student (25 分)

题目来源:PAT (Advanced Level) PracticeZhejiang 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

2021-08-10 11:48:45 91

原创 1074 Reversing Linked List

题目来源:PAT (Advanced Level) PracticeGiven 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→3

2021-08-09 12:45:04 82

原创 1097 Deduplication on a Linked List

题目来源:PAT (Advanced Level) PracticeGiven a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each value K, only the first node of which the value or absolute value of its

2021-08-09 11:43:28 78

原创 1052 Linked List Sorting

题目来源:PAT (Advanced Level) PracticeA linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now given a linked list, you

2021-08-08 23:11:10 126

原创 1032 Sharing

题目来源:PAT (Advanced Level) PracticeTo 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 a

2021-08-08 20:49:03 115

原创 1100 Mars Numbers

题目来源:PAT (Advanced Level) PracticePeople 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 t

2021-08-08 11:51:05 146

原创 1055 The World‘s Richest

题目来源:PAT (Advanced Level) PracticeForbes 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

2021-08-02 09:19:56 57

原创 1014 Waiting in Line

题目来源:PAT (Advanced Level) PracticeSuppose a bank has N 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 space inside the yellow l

2021-08-01 13:16:07 91

原创 1017 Queueing at Bank

题目来源:PAT (Advanced Level) PracticeSuppose 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 line, until it is his/

2021-07-31 12:23:15 91

原创 1132 Cut Integer

题目来源:PAT (Advanced Level) PracticeCutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334, we have A = 167 and B = 334. It is interesting to see that Z can b

2021-07-31 09:20:33 86

原创 1001 A+B Format

题目来源:PAT (Advanced Level) PracticeCalculate 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 te

2021-07-30 15:53:50 65

原创 1030 Travel Plan

题目来源:PAT (Advanced Level) PracticeA 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 start

2021-07-30 14:37:08 56

原创 1018 Public Bike Management

题目来源:PAT (Advanced Level) PracticeThere 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 return it to any other stations in the city.The Public Bi

2021-07-30 12:56:05 156

原创 1092 To Buy or Not to Buy

题目来源:PAT (Advanced Level) PracticeEva 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 who

2021-07-29 09:20:04 56

原创 1046 Shortest Distance

题目来源:PAT (Advanced Level) PracticeThe 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. F

2021-07-28 16:33:26 55

原创 1009 Product of Polynomials

题目来源:PAT (Advanced Level) PracticeThis 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

2021-07-28 15:42:42 64

原创 1094 The Largest Generation

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 input file contains one test case.

2021-07-28 12:59:16 29

原创 1105 Spiral Matrix (25 分)

题目来源:PAT (Advanced Level) PracticeThis time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the first element at the upper-left corner, then move in a clockwise spiral.

2021-07-28 12:16:25 292

原创 1057 Stack

题目来源:PAT (Advanced Level) PracticeStack 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

2021-07-28 10:02:42 110

原创 L2-023 图着色问题

题目来源:天梯赛图着色问题是一个著名的NP完全问题。给定无向图G=(V,E),问可否用K种颜色为V中的每一个顶点分配一种颜色,使得不会有两个相邻顶点具有同一种颜色?但本题并不是要你解决这个着色问题,而是对给定的一种颜色分配,请你判断这是否是图着色问题的一个解。输入格式:输入在第一行给出3个整数V(0<V≤500)、E(≥0)和K(0<K≤V),分别是无向图的顶点数、边数、以及颜色数。顶点和颜色都从1到V编号。随后E行,每行给出一条边的两个端点的编号。在图的信息给出之后,给出了一个

2021-07-26 19:58:30 193

原创 1007 Maximum Subsequence Sum

题目来源:PAT (Advanced Level) PracticeGiven a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined to be { N​i​​, N​i+1​​, ..., N​j​​ } where 1≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has the lar

2021-07-25 17:59:02 96

原创 1072 Gas Station

题目来源:PAT (Advanced Level) PracticeA 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 guarantee that all the houses are in its servi

2021-07-25 14:27:33 121

原创 1003 Emergency

题目来源:PAT (Advanced Level) PracticeAs 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 b

2021-07-25 11:44:08 58

空空如也

空空如也

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

TA关注的人

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