自定义博客皮肤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)
  • 收藏
  • 关注

原创 学习率到底是什么

文章目录一、学习率的定义二、那学习率有什么作用与影响?三、如何调整学习率?一、学习率的定义Wikipedia给出Learning Rate的定义如下In machine learning and statistics, the learning rate is a tuning parameter in an optimization algorithm that determines the step size at each iteration while moving toward a min

2021-11-10 09:15:54 28819

原创 js的出师不利

项目场景:刚刚开始在MDN上学JavaScript就遇到了第一个bug。顺便吐槽一下这个js学习文档各种网页跳转看着真有点乱。问题描述:很简单的一段教程,但我在我的IDEA里修改后运行并没有修改原因分析:代码肯定没什么问题,推测是环境有问题。直接搜下有人也遇到这个问题,在chrome上也出现这种情况,但Firefox上就不会。解答的人推荐了一篇MDN的文章讲解本地测试服务器的搭建。https://developer.mozilla.org/zh-CN/docs/Learn/Common_

2021-11-08 21:16:45 858

原创 SQL server 数据查询

文章目录前言基础语法一、单表查询1. 选择表中的若干列2. 选择表中的若干元组二、使用步骤1.引入库2.读入数据总结前言本文简单总结下数据查询语句基础语法单行注释:-- 多行注释/* … */ 一、单表查询1. 选择表中的若干列--查询指定列select sno, snamefrom student;--查询全部列select *from student;--查询经过计算的值select sname, 2014-sagefrom student;--设置别名s.

2021-11-08 11:24:28 3076

原创 15. 3Sum(Medium)

Source: https://leetcode.com/problems/3sum/Time: 2020/12/20DescriptionGiven an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Notice that the solut

2020-12-20 14:17:01 135

原创 11. Container With Most Water (Medium)

Source:https://leetcode.com/problems/container-with-most-water/Time:2020/12/20DescriptionGiven n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the lin

2020-12-20 10:20:22 130 1

原创 10. Regular Expression Matching

Source: https://leetcode.com/problems/regular-expression-matching/Time: 2020/12/18DescriptionGiven an input string (s) and a pattern §, implement regular expression matching with support for ‘.’ and ‘*’ where:‘.’ Matches any single character.​​​​‘*’ M

2020-12-19 19:09:02 94

原创 Leetcode 4. Median of Two Sorted Arrays(Hard)

//Source:https://leetcode.com/problems/median-of-two-sorted-arrays///TIme:2020/11/20这题有点东西的,之后有时间要再看看。Solution里讲得非常清楚了DescriptionGiven two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.Follow u

2020-11-20 10:26:26 110

原创 Leetcode3. Longest Substring Without Repeating Characters(Medium)

Source:https://leetcode.com/problems/longest-substring-without-repeating-characters/Time:2020/11/18DescriptionGiven a string s, find the length of the longest substring without repeating characters.Example 1:Input: s = “abcabcbb”Output: 3Explanation

2020-11-18 02:03:08 72

原创 Leetcode 2. Add Two Numbers (Medium)

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.You may assume the two number

2020-11-16 20:10:46 69

原创 Leetcode 1 Two-sum(Easy)

Source:https://leetcode.com/problems/two-sum/Time: 2020/11/15Description:Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.You may assume that each input would have exactly one solu

2020-11-15 12:39:12 96

原创 ADT Queue 四种实现

讲四种实现(普通数组模拟队列实现不讲,很轻便也很实用,不难自己随意写写就行)四种队列实现循环队列(Circular queue)链表队列(Linked queue)C++STL < queue >用两个栈来实现一个队列循环队列(Circular queue)队列和栈在使用时,即使操作数很多,但一般实时存储在其中的数据并不多,于是我们采用循环队列的方式来节省空间。那循环队列其实就是,当队列中申请好的连续空间中已经填满数据时(并不是指队列已满,队列是只夹在front和rear之间的数据,包

2020-11-09 18:50:04 381

原创 Stack C++STL

还是C++的STL用起来最方便可以通过这篇简单了解定义与几个操作如何用,然后就可以直接上手了https://blog.csdn.net/lyj2014211626/article/details/66967761最经典的后缀表达式简单题https://www.luogu.com.cn/problem/P1449题目描述所谓后缀表达式是指这样的一个表达式:式中不再引用括号,运算符号放在两个运算对象之后,所有计算按运算符号出现的顺序,严格地由左而右新进行(不用考虑运算符的优先级)。如:3*(5–2

2020-11-08 02:59:21 76

原创 ADT Stack 链表与数组实现

讲三种栈的实现栈的数组实现,栈的链表实现,用C++STL类中的Stack一个好的ADT,调用例程是应该不需要知道内部实现,所以Sqstack和Linkstack中实现的各种操作,调用方法将会是相同的。第一种栈的数组实现#include<iostream>#include<cstdio>#include<cstdlib>using namespace std;#define EmptyTOS -1#define MaxStackSize 100

2020-11-05 17:43:01 235

原创 Homework02解析

稍微写下解答,不保证对[2-1] 编写一个实现在顺序表中删除给定元素操作的函数:bool deletion(sqList &L, element e);这篇博客以及很好了https://blog.csdn.net/qq_37618760/article/details/104207248[2-2] 编写一个实现在单链表中的元素a之前插入元素b操作的函数:bool insertion(linknode *hp, element a, element b);看我上篇博客https://bl

2020-11-05 00:22:53 296

原创 Linear List(ADT)

***抽象数据类型(Abstract Data Type, ADT)*是一些操作的集合。表ADT顺序表不想讲链表(Linked List)表头很重要。在位置0处留出一个标志节点,成为表头(header)或者哑结点(dummy node)。一般来说有两种链表,含表头的与不含表头的,这边只讨论含表头的写法,有时间就自己实现下不含表头的写法。在这之前补一些C语言的语法:(不具体展开,就说几个点看看会不会,不会就查查,提供部分参考资料,页码为C PrimerPlus的页码)基本指针操作结构体的

2020-11-01 23:39:12 410

原创 Chapter02 算法分析

参考书本:Data Structure and Algorithm Analysis in C参考课程:浙江大学-数据结构 陈越姥姥几个概念:Def: T(N) <= cf(N) 记为 T(N) = O(f(N))T(N) >= cf(N) 记为 T(N) = Ω(f(N))在算法分析中,比较函数值的大小是没有意义的,于是比较它们的相对增长率(relative rate of growth)注意:不要将低阶项或常数放入大O。不要写T(N) = O( 2N2 ) 或 T(

2020-10-21 19:39:31 1067 5

原创 P1379 八数码难题

题目描述在3×3的棋盘上,摆有八个棋子,每个棋子上标有1至8的某一数字。棋盘中留有一个空格,空格用0来表示。空格周围的棋子可以移到空格中。要求解的问题是:给出一种初始布局(初始状态)和目标布局(为了使题目简单,设目标状态为123804765),找到一种最少步骤的移动方法,实现从初始布局到目标布局的转变。输入格式输入初始状态,一行九个数字,空格用0表示输出格式只有一行,该行只有一个数字,表示从初始状态到目标状态需要的最少移动次数(测试数据中无特殊无法到达目标状态数据)输入输出样例输入 #1复制

2020-09-08 19:46:36 357

原创 P4913 【深基16.例3】二叉树深度

题目描述给出每个节点的两个儿子节点,建立一棵二叉树(根节点为 11),如果是叶子节点,则输入0 0。建好树后希望知道这棵二叉树的深度。二叉树的深度是指从根节点到叶子结点时,最多经过了几层。最多有 10^6106个结点。输入格式无输出格式无输入输出样例输入 #1复制72 73 64 50 00 00 00 0输出 #1复制4#include <iostream>using namespace std; const int MAXN = 10e6 +

2020-08-28 17:02:46 237

原创 P4715 【深基16.例1】淘汰赛

题目描述有 2^n(n\le7)2n(n≤7) 个国家参加世界杯决赛圈且进入淘汰赛环节。我经知道各个国家的能力值,且都不相等。能力值高的国家和能力值低的国家踢比赛时高者获胜。1 号国家和 2 号国家踢一场比赛,胜者晋级。3 号国家和 4 号国家也踢一场,胜者晋级……晋级后的国家用相同的方法继续完成赛程,直到决出冠军。给出各个国家的能力值,请问亚军是哪个国家?输入格式无输出格式无输入输出样例输入 #1复制34 2 3 1 10 5 9 7输出 #1复制1#include <i

2020-08-28 16:35:55 239

原创 UVA524 素数环 Prime Ring Problem

UVA好卡,没上去提,应该没什么问题题意翻译输入正整数 nn,把整数 1,2,\dots ,n1,2,…,n 组成一个环,使得相邻两个整数之和均为素数。输出时,从整数 11 开始逆时针排列。同一个环恰好输出一次。n\leq 16n≤16,保证一定有解。多组数据,读入到 EOF 结束。第 ii 组数据输出前加上一行 Case i:相邻两组数据中间加上一个空行。输入输出样例输入 #1复制68输出 #1复制Case 1:1 4 3 2 5 61 6 5 2 3 4Case 2:1 2

2020-08-24 13:39:36 138

原创 P1219 [USACO1.5]八皇后 Checker Challenge

https://www.luogu.com.cn/problem/P1219题目描述一个如下的 6 \times 66×6 的跳棋棋盘,有六个棋子被放置在棋盘上,使得每行、每列有且只有一个,每条对角线(包括两条主对角线的所有平行线)上至多有一个棋子。上面的布局可以用序列 2\ 4\ 6\ 1\ 3\ 52 4 6 1 3 5 来描述,第 ii 个数字表示在第 ii 行的相应位置有一个棋子,如下:行号 1\ 2\ 3\ 4\ 5\ 61 2 3 4 5 6列号 2\ 4\ 6\ 1\ 3\ 52 4

2020-08-23 15:19:07 153

原创 子集生成(位向量法、增量构造法)

什么是子集生成?算法竞赛经典入门中的解释:给定一个集合,枚举所有的可能的子集。位向量法什么是位向量法?通过构造一个标记向量pd[i],而不直接构造存放题目数据的子集A。当pd[i]==true的时候,标记了了我们把数据集合中的第i个位置的数据放入一个子集中,这一切都是通过标记数组pd[]来实现的。#include <iostream>#include <cstdio>#include <string.h>using namespace std;in

2020-08-23 10:44:22 362

原创 P1177 【模板】快速排序

https://www.luogu.com.cn/problem/P1177题目描述利用快速排序算法将读入的 NN 个数从小到大排序后输出。快速排序是信息学竞赛的必备算法之一。对于快速排序不是很了解的同学可以自行上网查询相关资料,掌握后独立完成。(C++C++ 选手请不要试图使用 STL,虽然你可以使用 sort 一遍过,但是你并没有掌握快速排序算法的精髓。)输入格式第 11 行为一个正整数 NN,第 22 行包含 NN 个空格隔开的正整数 a_iai​ ,为你需要进行排序的数,数据保证了

2020-08-19 15:30:54 162

原创 纯c实现字符串中字串的查找与替换

#include <stdio.h>#include <string.h>//查找 int replace_str( char*str, char* sub, char* repstr);//替换int replace_str_step2( char*str, char* sub, char* repstr, int t);int main(){ char str[100], sub[80], repstr[80]; int n; gets(str).

2020-06-11 17:50:58 579

原创 P1308 统计单词数字符串

题目描述一般的文本编辑器都有查找单词的功能,该功能可以快速定位特定单词在文章中的位置,有的还能统计出特定单词在文章中出现的次数。现在,请你编程实现这一功能,具体要求是:给定一个单词,请你输出它在给定的文章中出现的次数和第一次出现的位置。注意:匹配单词时,不区分大小写,但要求完全匹配,即给定单词必须与文章中的某一独立单词在不区分大小写的情况下完全相同(参见样例1 ),如果给定单词仅是文章中某一单词的一部分则不算匹配(参见样例2 )。输入格式共22行。第11行为一个字符串,其中只含字母,表示给定单词;

2020-05-28 16:08:54 320

原创 笨小猴 洛谷P1125 字符串

题目描述笨小猴的词汇量很小,所以每次做英语选择题的时候都很头疼。但是他找到了一种方法,经试验证明,用这种方法去选择选项的时候选对的几率非常大!这种方法的具体描述如下:假设maxn是单词中出现次数最多的字母的出现次数,minn是单词中出现次数最少的字母的出现次数,如果maxn-minn是一个质数,那么笨小猴就认为这是个Lucky Word,这样的单词很可能就是正确的答案。输入格式一个单词,其中只可能出现小写字母,并且长度小于100100。输出格式共两行,第一行是一个字符串,假设输入的的单词是Luc

2020-05-28 14:32:15 550

原创 Fractions Again?! UVA - 10976

It is easy to see that for every fraction in the form 1 k (k > 0), we can always find two positive integers x and y, x ≥ y, such that: 1 k = 1 x + 1 y Now our question is: can you write a program that counts how many such pairs of x and y there are for a

2020-05-21 21:30:55 130

原创 Maximum Product

Problem D - Maximum ProductTime Limit: 1 secondGiven a sequence of integers S = {S1, S2, …, Sn}, you should determine what is the value of the maximum positive product involving consecutive terms of S. If you cannot find a positive sequence, you should c

2020-05-21 20:52:15 109

原创 PTA1013 数素数

令 P​i​​ 表示第 i 个素数。现任给两个正整数 M≤N≤10^4,请输出 P​M到P​N的所有素数。输入格式:输入在一行中给出 M 和 N,其间以空格分隔。输出格式:输出从 PM到 P​N​​ 的所有素数,每 10 个数字占 1 行,其间以空格分隔,但行末不得有多余空格。输入样例:5 27输出样例:11 13 17 19 23 29 31 37 41 4347 53 59 61 67 71 73 79 83 8997 101 103#include <cstdio&g

2020-05-15 23:25:48 174

原创 简单枚举 Division UVA 725

Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits 0through 9 once each, such that the first number divided by the second is equal to an integer N, where2 ≤ N ≤ 79. That is,abcdefghij = Nwhere each le

2020-05-13 22:51:18 134

原创 最小生成树Prim算法

经典运用城市铺路问题最小生成树有prim和Kruskal两种算法两者相比较Prim算法适合于解决边稠密的网这边先介绍Prim算法时间复杂度是O(n^2)牛客上有道选择题答案说是O(n+e)我是不太明白下面是模拟过程Sample Input9 150 1 100 5 111 2 181 6 162 3 222 8 83 4 203 7 163 6 243 8 214 5 264 7 75 6 176 7 191 8 12Sample Output0 10

2020-05-13 11:55:42 219

原创 Common Subsequence (POJ1458) dp

DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, …, xm > another sequence Z = < z1, z2, …, zk > is a subsequence of X if there exists a strictly incr

2020-05-09 21:58:15 174

原创 最长上升子序列(百练2527) 动规

描述一个数的序列bi,当b1 < b2 < … < bS的时候,我们称这个序列是上升的。对于给定的一个序列(a1, a2, …, aN),我们可以得到一些上升的子序列(ai1, ai2, …, aiK),这里1 <= i1 < i2 < … < iK <= N。比如,对于序列(1, 7, 3, 5, 9, 4, 8),有它的一些上升子序列,如(1,...

2020-05-07 23:27:35 79

原创 The Triangle (POJ1163) 动态规划

http://poj.org/problem?id=1163Description 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the ...

2020-05-07 22:28:01 188

原创 映射 map (uva156)

156 AnanagramsMost crossword puzzle fans are used to anagrams — groups of words with the same letters in differentorders — for example OPTS, SPOT, STOP, POTS and POST. Some words however do not have...

2020-05-04 15:43:30 146

原创 集合:set (UVA10815)

Andy’s First DictionaryProblem DescriptionAndy, 8, has a dream - he wants to produce hisvery own dictionary. This is not an easy task forhim, as the number of words that he knows is,well, not qui...

2020-05-04 15:06:37 172

原创 The Blocks Problem (vector)

这是不定长数组vector的一道练习题题目较长,下面有简单题目解释The Blocks Problem (UVA01)Many areas of Computer Science use simple, abstract domains for both analytical and empirical studies.For example, an early AI study of p...

2020-05-01 12:49:46 244

原创 Deep-First-Search Series 1

**深度优先搜索(DFS)**是一个重要的基础算法Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (selecting some arbitrary node as t...

2020-04-14 20:53:54 302

原创 最大子序列和(数据结构)

介绍四种算法,暴力解是O(n^3)的复杂度,而最简的方法只要O(n)。Problem Description求取数组中最大连续子序列和(如果最大和是负数,输出0)算法一 暴力解O(n^3)很容易想到,把所有子序列和都求出,比较出最大的一个int MaxSubseqSum1(int A[], int N){ int ThisSum, MaxSum = 0; int i,j,k; ...

2020-04-11 22:37:31 332

原创 Clock Tick 测试程序运行时间的函数

直接上代码,附详细注释记住要放头文件和定义变量#include <cstdio>#include <ctime>//单位是clock tick clock_t start,stop;// clock_t是clock()函数返回的变量类型 double duration;//记录被测函数的运行时间,单位秒void MyFunction(){ //C...

2020-04-09 21:24:19 1287

空空如也

空空如也

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

TA关注的人

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