自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 k-近邻算法

先验知识numpy.argsort(a, axis=-1, kind=’quicksort’, order=None)返回的是数组值从小到大的索引值参数:a为要排序的数组axis:按哪一维进行排序kind:排序算法的选择,有quicksort,mergesort,heapsort对于一维数组>>>import numpy as np>>>x=np.array([1,4,3,-1,5,9])>>>x.argsort()a...

2020-10-22 17:14:40 91

原创 Ubuntu操作心得(写的很乱 方便自己观看)

更改root账户密码命令行输入 sudo passwd root 然后输入当前用户密码, 在输入要修改的root用户密码安装软件 apt-get install xxx 升级软件 -get 配置文件目录 /etc/apt更改软件源进入 /etc/apt 目录 然后先清空 source.list 命令为 >source.list网络中寻找国内的镜像,这里推荐一个软...

2019-11-22 20:51:00 244

原创 201509-3模板生成系统

问题描述试题编号: 201509-3 试题名称: 模板生成系统 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述   成成最近在搭建一个网站,其中一些页面的部分内容来自数据库中不同的数据记录,但是页面的基本结构是相同的。例如,对于展示用户信息的页面,当用户为 Tom 时,网页的源代码是   而当用户为 J...

2019-08-23 22:22:37 104

原创 201503-3节日

问题描述试题编号: 201503-3 试题名称: 节日 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述   有一类节日的日期并不是固定的,而是以“a月的第b个星期c”的形式定下来的,比如说母亲节就定为每年的五月的第二个星期日。   现在,给你a,b,c和y1,y2(1850 ≤y1,y2≤ 20...

2019-08-22 22:05:34 137

原创 201412-3集合竞价

问题描述试题编号: 201412-3 试题名称: 集合竞价 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述   某股票交易所请你编写一个程序,根据开盘前客户提交的订单来确定某特定股票的开盘价和开盘成交量。   该程序的输入由很多行构成,每一行为一条记录,记录可能有以下几种:   1. buy p ...

2019-08-21 22:26:01 125

原创 201409-3字符串匹配

问题描述试题编号: 201409-3 试题名称: 字符串匹配 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述   给出一个字符串和多行文字,在这些文字中找到字符串出现的那些行。你的程序还需支持大小写敏感选项:当选项打开时,表示同一个字母的大写和小写看作不同的字符;当选项关闭时,表示同一个字母的大写和小写看作相...

2019-08-21 21:01:47 91

原创 201403-3命令行选项

问题描述试题编号: 201403-3 试题名称: 命令行选项 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述   请你写一个命令行分析程序,用以分析给定的命令行里包含哪些选项。每个命令行由若干个字符串组成,它们之间恰好由一个空格分隔。这些字符串中的第一个为该命令行工具的名字,由小写字母组成,你的程序不用对它进...

2019-08-20 22:24:45 77

原创 201312-3最大的矩形

问题描述试题编号: 201312-3 试题名称: 最大的矩形 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述   在横轴上放了n个相邻的矩形,每个矩形的宽度是1,而第i(1 ≤ i ≤ n)个矩形的高度是hi。这n个矩形构成了一个直方图。例如,下图中六个矩形的高度就分别是3, 1, 6, 5, 2, 3。 ...

2019-08-20 21:44:53 68

原创 1017 Queueing at Bank (25 分)

Suppose a bank hasKwindows 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 li...

2019-08-19 22:22:21 92

原创 1057 Stack (30 分)

Stack 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 Po...

2019-08-17 21:45:46 91

原创 最长回文子串

#include <iostream>#include <cstring>using namespace std;const int N = 1010;char str[N];int dp[N][N];int main() { //patzjujztaccbcc scanf("%s", str); int len = strlen(str),...

2019-08-16 22:30:14 58

原创 最长公共子序列

#include <iostream>#include <cstring> using namespace std;const int N = 100;char a[N], b[N];int dp[N][N]; int main() { // asdstory adminsorry scanf("%s %s", a, b); int n = s...

2019-08-16 21:24:03 66

原创 1045 Favorite Color Stripe (30 分)

Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the remaining parts...

2019-08-15 22:28:33 91

原创 最长不下降子序列

#include <iostream>using namespace std;const int N = 100;int a[N], dp[N]; int main() { int n, ans = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a[i]);...

2019-08-15 21:54:25 79

原创 1007 Maximum Subsequence Sum (25 分)

Given a sequence ofKintegers {N​1​​,N​2​​, ...,N​K​​}. A continuous subsequence is defined to be {N​i​​,N​i+1​​, ...,N​j​​} where1≤i≤j≤K. The Maximum Subsequence is the continuous subsequen...

2019-08-15 21:27:21 69

原创 最大子段和

#include <iostream>using namespace std;int a[100], dp[100]; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } dp[0] = a[0];...

2019-08-14 23:00:53 69

原创 数塔(dp)

#include <iostream>using namespace std; int main() { int f[10][10], dp[10][10]; int n; scanf("%d", &n); for (int i = 0; i < n; i++) { for (int j = 0; j <= i; j++) { scan...

2019-08-14 22:51:02 74

原创 Prim

#include <iostream>#include <algorithm>using namespace std;const int N = 510;const int INF = 0x3fffffff;int n, m, G[N][N];int d[N];bool vis[N] = {false};int path[N];int Prim(i...

2019-08-14 22:03:56 91

原创 kruskal

#include <iostream>#include <algorithm>using namespace std;const int N = 110;const int M = 10010;struct edge { int u, v; int cost;}E[M];int n, m;bool cmp(edge a, edge b) { ...

2019-08-14 22:03:20 72

原创 1087 All 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 happiness.Input Specification:Each ...

2019-08-13 23:42:13 58

原创 1072 Gas 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 guarantee that all the hou...

2019-08-13 22:07:21 88

原创 1018 Public 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 return it to any other stations in the ...

2019-08-12 23:17:03 65

原创 Floyd

#include <iostream>#include <algorithm>using namespace std;const int N = 510;const int INF = 0x3fffffff;int n, m;int dis[N][N];void Floyd() { for (int k = 0; k < n; k++) {...

2019-08-12 21:41:09 70

原创 SPFA

#include <iostream>#include <cstring>#include <vector>#include <algorithm>#include <queue>using namespace std;const int N = 510;const int INF = 0x3fffffff;stru...

2019-08-11 21:51:32 77

原创 1030 Travel Plan (30 分)(dijkstra+dfs)

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

2019-08-11 21:24:57 74

原创 1093 字符串A+B (20 分)

给定两个字符串A和B,本题要求你输出A+B,即两个字符串的并集。要求先输出A,再输出B,但重复的字符必须被剔除。输入格式:输入在两行中分别给出A和B,均为长度不超过10​6​​的、由可见 ASCII 字符 (即码值为32~126)和空格组成的、由回车标识结束的非空字符串。输出格式:在一行中输出题面要求的A和B的和。输入样例:This is a ...

2019-08-10 22:16:48 60

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

2019-08-10 22:00:40 75

原创 最短路径(迪杰斯特拉算法)

#include <iostream>#include <algorithm>using namespace std;const int maxn = 1000;const int INF = 1000000000;int Map[maxn][maxn];int n, m, s;int d[maxn];bool visited[maxn] = {fal...

2019-08-09 22:40:53 220

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

2019-08-09 22:23:04 79

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

2019-08-09 21:55:41 203

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

2019-08-09 21:30:28 171

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

2019-08-08 19:35:19 99

原创 1079 Total Sales of Supply Chain (25 分)

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

2019-08-04 21:43:06 64

原创 1053 Path 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 of all the nodes along the path fro...

2019-08-04 21:29:47 116

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

2019-08-04 20:47:12 46

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

2019-08-03 23:12:06 58

原创 1020 Tree 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 traversal sequence of the cor...

2019-08-03 22:07:16 92

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

2019-08-02 22:23:07 59

原创 1103 Integer Factorization (30 分)

TheK−Pfactorization of a positive integerNis to writeNas the sum of theP-th power ofKpositive integers. You are supposed to write a program to find theK−Pfactorization ofNfor any positive...

2019-08-02 21:36:25 82

原创 1025 反转链表 (25 分)

给定一个常数K以及一个单链表L,请编写程序将L中每K个结点反转。例如:给定L为 1→2→3→4→5→6,K为 3,则输出应该为 3→2→1→6→5→4;如果K为 4,则输出应该为 4→3→2→1→5→6,即最后不到K个元素不反转。输入格式:每个输入包含 1 个测试用例。每个测试用例第 1 行给出第 1 个结点的地址、结点总个数正整数N(≤10​5​​)、以及...

2019-08-01 22:49:38 78

空空如也

空空如也

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

TA关注的人

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