自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 MEX and Increments

到底是谁来构成mex所需要的0~i-1的元素?让最接近i的数来构造!

2022-06-03 18:59:44 248

原创 天梯赛L1(1-80)

集齐天梯赛至2021年的全部真题

2022-04-18 21:01:19 706

原创 Choosing Capital for Treeland(树形DP)

The country Treeland consists ofncities, some pairs of them are connected withunidirectionalroads. Overall there aren - 1roads in the country. We know that if we don't take the direction of the roads into consideration, we can get from any city to a...

2022-04-06 18:02:44 576

原创 Pipes

先从(1,1)开始找,对应数组就是a[0][0]若a[0][0] > 2:也就是此时只能向上或者向下流。就看a[1][0]能不能往右流。 若a[0][0] <= 2:他能往右流。这一列就过去了,就看下一列了,也就是a[0][1]。总结就是,当前若不能往下右流,就往上或下流后看另一行能不能往右,若还是不能往右,则不能流通。若最后留到了最后一列,但是只能流到上面一行,也就是r = 0.那也会失败,因为要求是到达(2,n+1)。完整代码:#include<bits/..

2022-04-06 13:09:36 202

原创 2018年蓝桥杯省赛 C++ B组

1. 螺旋折线 1.1 原题概要如图所示的螺旋折线经过平面上所有整点恰好一次。对于整点(X, Y),我们定义它到原点的距离dis(X, Y)是从原点到(X, Y)的螺旋折线段的长度。例如dis(0, 1)=3, dis(-2, -1)=9给出整点坐标(X, Y),你能计算出dis(X, Y)吗?这一题为了AK,我花了较长时间,关键是要细节,不能出错。比赛的时候建议把代码敲得好看点,这样逻辑更加清晰。这一题是个分类讨论的题,建议分完一种类就检查一下错误。确保之前...

2022-04-01 19:08:10 1341

原创 Baby Ehab Partitions Again

Baby Ehab was toying around with arrays. He has an arrayaaof lengthnn. He defines an array to be good if there's no way to partition it into22subsequences such that the sum of the elements in the first is equal to the sum of the elements in the secon...

2022-03-29 22:28:50 553 3

原创 第十二届蓝桥杯省赛第一场C++A/B/C组真题

1. 砝码称重一个有限制的背包问题。状态标识: 表示:考虑前i件砝码,重量为j的情况能否构造。 1.1 时间复杂度分析这样dp的好处是,我们通过不同的构造方式能构造出相同的重量,试想暴力的思路:经典的生成子集问题,每件砝码都有选或不选两种情况,如此排列组合,最终构造方式是2^n - 1 (除去了空集),把所有状态都尝试遍历一并啊,一定会超时。2^32 - 1就是int的最大值。而1秒内,能过的c/c++程序在1e7~1e8间。而当状态表示为某重量是否可以构造出来。那所需...

2022-03-24 19:25:06 1483

原创 无监督学习(含自编码器在MNIST上的图片重建实战)

含自编码器在MNIST上的图片重建实战

2022-03-21 11:21:44 1281 1

原创 循环神经网络(内含LSTM、GRU实战)

内含LSTM、GRU实战

2022-03-21 11:19:16 2535

原创 卷积神经网络(含LeNet-5、AlexNet、BN、VGG、GoogleNet、ResNet实战)

含LeNet-5、AlexNet、BN、VGG、GoogleNet、ResNet实战

2022-03-21 11:15:55 4727

原创 tensorflow-Keras高层接口

1. 模型的装配、训练和测试import tensorflow as tfimport matplotlib.pyplot as pltfrom tensorflow import kerasfrom tensorflow.keras import Sequential,layersx = tf.constant([1.,2.])# 实例化 一个softmaxsoftmax = keras.layers.Softmax()softmax(x)#直接用不能用,只能先实例化ker

2022-03-21 11:10:54 1500

原创 tensorflow2常用语句(实战)

1. 变量与张量介绍 import tensorflow as tftf.__version__# 张量 Tensor 张量其实就是一个多维数组# 张量的维度可以是0 : 1,2,3# dim = 0 : 1,2,3 (一组数)# dim = 1 : [1,2,3] (向量)# dim = 2 : [ [2,3],[4,4] ] (二维矩阵)tf.constant(1.)#无法进行浮点数转整数# tf.Variable(1.,dtype=tf.int32)#但可以整数...

2022-03-21 11:08:34 1004

原创 前馈神经网络

1. 神经元与激活函数神经元:下图有d个输入,我们可以认为当d是净输入的时候,d就是神经元的输入,让净输入加权求和并加上偏执项,并最终求和,得到一个输出,将这个输出作为激活函数的输入,其会对加权和再做一次运算最后输出a。这就是一个典型的神经元。激活函数:对于上图右部分即激活函数,其主要作用就是加强网络的表达能力,还有学习能力。我们要求激活函数是:1.连续的,可以允许个别点不可导,但绝大多数都是可导的,并且是非线性的。这样的函数是可...

2022-03-21 11:05:43 9016

原创 神经网络基础-线性模型

目录1. 分类介绍2. 线性模型处理分类问题3.二分类问题4. 多分类5. 从概率角度看待分类问题 5.1. 多元线性回归进行分类产生的问题 5.2. 从概率角度解决分类问题6. 交叉熵 6.1. 信息量的数学期望就是熵 6.2. 相对熵7. 逻辑回归(实战)8.softmax 8.1. 理论 8.2. softmax(实战)9. 感知器...

2022-03-21 10:58:18 1080

原创 机器学习基础

机器学习的三要素1.1. 模型 首先明确机器学习的主要任务:确定样本空间的输入x和输出y,及x和y之间找到一个f(x,) -> y。 的模型f(x,) ,且尽可能与输出y相匹配。一开始不知道这样的函数是什么样的,所以我们要g根据经验,假设有一个函数集合(f1,f2,f3,f4,f5……,fn),这样的假设函数集合有时候也成为假设空间,我们通过观察,这一系列函数,在训练集中的表现,来选取一个fi在训练集D中最理想,那么fi就是最适合的,或者说是最理想的假设。 我们常说的...

2022-03-21 10:49:57 927

原创 Number of Ways

You've got arraya[1], a[2], ..., a[n], consisting ofnintegers. Count the number of ways to split all the elements of the array into three contiguous parts so that the sum of elements in each part is the same.More formally, you need to find the number...

2022-03-18 22:19:53 321

原创 Road Optimization

The Government of Mars is not only interested in optimizing space flights, but also wants to improve the road system of the planet.One of the most important highways of Mars connects Olymp City and Kstolop, the capital of Cydonia. In this problem, we on.

2022-03-16 15:25:25 179

原创 Maximum Sum of Products

You are given two integer arraysaaandbbof lengthnn.You can reverseat most onesubarray (continuous subsegment) of the arrayaa.Your task is to reverse such a subarray that the sum∑i=1nai⋅bi∑i=1nai⋅biismaximized.InputThe first line contain...

2022-03-16 09:36:38 140

原创 Factorials and Powers of Two

A number is calledpowerfulif it is a power of two or a factorial. In other words, the numbermmis powerful if there exists a non-negative integerddsuch thatm=2dm=2dorm=d!m=d!, whered!=1⋅2⋅…⋅dd!=1⋅2⋅…⋅d(in particular,0!=10!=1). For example11,4...

2022-03-16 08:38:52 281 2

原创 Epic Transformation

You are given an arrayaaof lengthnnconsisting of integers. You can apply the following operation, consisting of several steps, on the arrayaazeroor more times:you select twodifferentnumbers in the arrayaiaiandajaj; you removeii-th andjj-t...

2022-03-15 17:03:04 163

原创 Harmonious Graph

You're given an undirected graph withnnnodes andmmedges. Nodes are numbered from11tonn.The graph is consideredharmoniousif and only if the following property holds:For every triple of integers(l,m,r)(l,m,r)such that1≤l<m<r≤n1≤l<m&...

2022-03-15 13:21:28 1169

原创 New Year Permutation

User ainta has a permutationp1, p2, ..., pn. As the New Year is coming, he wants to make his permutation as pretty as possible.Permutationa1, a2, ..., anisprettierthan permutationb1, b2, ..., bn, if and only if there exists an integerk(1 ≤ k ≤ n...

2022-03-15 00:21:10 78

原创 Say No to Palindromes

Let's call the stringbeautifulif it does not contain a substring of length at least22, which is a palindrome. Recall that a palindrome is a string that reads the same way from the first character to the last and from the last character to the first. Fo...

2022-03-14 23:29:58 372

原创 PTA团体天体赛 L2-010 排座位 (25 分)

布置宴席最微妙的事情,就是给前来参宴的各位宾客安排座位。无论如何,总不能把两个死对头排到同一张宴会桌旁!这个艰巨任务现在就交给你,对任何一对客人,请编写程序告诉主人他们是否能被安排同席。输入格式:输入第一行给出3个正整数:N(≤100),即前来参宴的宾客总人数,则这些人从1到N编号;M为已知两两宾客之间的关系数;K为查询的条数。随后M行,每行给出一对宾客之间的关系,格式为:宾客1 宾客2 关系,其中关系为1表示是朋友,-1表示是死对头。注意两个人不可能既是朋友又是敌人。最后K行,每行给出一对需要查.

2022-03-04 16:05:33 93

原创 PTA团体天梯赛 L2-008 最长对称子串 (25 分)

对给定的字符串,本题要求你输出最长对称子串的长度。例如,给定Is PAT&TAP symmetric?,最长对称子串为s PAT&TAP s,于是你应该输出11。输入格式:输入在一行中给出长度不超过1000的非空字符串。输出格式:在一行中输出最长对称子串的长度。输入样例:Is PAT&TAP symmetric?输出样例:11对称子序列,可以通过枚举中心点来实现。#include <bits/stdc++.h>#def.

2022-03-03 23:21:16 85

原创 L2-006 树的遍历 (25 分)

中,后续,求前序

2022-02-19 20:08:49 59

原创 L3-010 是否完全二叉搜索树 (30 分)

将一系列给定数字顺序插入一个初始为空的二叉搜索树(定义为左子树键值大,右子树键值小),你需要判断最后的树是否一棵完全二叉树,并且给出其层序遍历的结果。输入格式:输入第一行给出一个不超过20的正整数N;第二行给出N个互不相同的正整数,其间以空格分隔。输出格式:将输入的N个正整数顺序插入一个初始为空的二叉搜索树。在第一行中输出结果树的层序遍历结果,数字间以1个空格分隔,行的首尾不得有多余空格。第二行输出YES,如果该树是完全二叉树;否则输出NO。输入样例1:938 45 42 24.

2022-02-19 16:30:21 73

原创 L2-004 这是二叉搜索树吗? (25 分)

原题链接一棵二叉搜索树可被递归地定义为具有下列性质的二叉树:对于任一结点,其左子树中所有结点的键值小于该结点的键值; 其右子树中所有结点的键值大于等于该结点的键值; 其左右子树都是二叉搜索树。所谓二叉搜索树的“镜像”,即将所有结点的左右子树对换位置后所得到的树。给定一个整数键值序列,现请你编写程序,判断这是否是对一棵二叉搜索树或其镜像进行前序遍历的结果。输入格式:输入的第一行给出正整数N(≤1000)。随后一行给出N个整数键值,其间以空格分隔。输出格式:如果输入序列...

2022-02-19 16:23:11 198

原创 Swaps

You are given two arraysaaandbbof lengthnn. Arrayaacontains eachoddinteger from11to2n2nin an arbitrary order, and arraybbcontains eacheveninteger from11to2n2nin an arbitrary order.You can perform the following operation on those arr...

2022-02-14 21:06:49 553

原创 Ciel and Flowers

Fox Ciel has some flowers:rred flowers,ggreen flowers andbblue flowers. She wants to use these flowers to make several bouquets. There are 4 types of bouquets:To make a "red bouquet", it needs 3 red flowers. To make a "green bouquet", it needs 3 ...

2022-02-13 12:04:34 320

原创 Berland Crossword

Berland crossword is a puzzle that is solved on a square grid withnnrows andnncolumns. Initially all the cells are white.To solve the puzzle one has to color some cells on the border of the grid black in such a way that:exactlyUUcells in the top ...

2022-02-13 11:05:52 232

原创 Maze。

Pavel loves grid mazes. A grid maze is ann × mrectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side.Pavel drew a grid maze with all empty cells forming a co..

2022-02-12 22:35:16 74

原创 Kefa and Park

题解就是树的遍历,只不过要注意一下,判断是否是叶子结点的方式:若深度为1,且u = h[u],即叶子结点。

2022-02-12 21:00:12 438

原创 Taxes

哥德巴赫猜想:1. 任何大于2的偶数都可以写成两个素数之和。因此所有偶数都能被拆除2个素数2. 任何大于7的奇数都可以写成三个素数之和。3 5 7 都是素数本身,大于7的素数可以有两种方式构建,一种:一个素数+2,二种:三个素数

2022-01-27 11:40:28 258

原创 Multiplication Table

Bizon the Champion isn't just charming, he also is very smart.While some of us were learning the multiplication table, Bizon the Champion had fun in his own manner. Bizon the Champion painted ann × mmultiplication table, where the element on the inters..

2022-01-27 11:27:24 494

原创 Divine Array

Black is gifted with a Divine arrayaaconsisting ofnn(1≤n≤20001≤n≤2000) integers. Each position inaahas an initial value. After shouting a curse over the array, it becomes angry and starts an unstoppable transformation.The transformation consists of...

2022-01-26 11:48:55 181

原创 Strange Function

给一个n,我们要求f(1) + f(2) + ……+f(n)。其中f[x]等于不被x整除的大于1的最小整数。

2022-01-23 21:13:01 774

原创 Plus and Multiply

There is an infinite set generated as follows:11is in this set. Ifxxis in this set,x⋅ax⋅aandx+bx+bboth are in this set.For example, whena=3a=3andb=6b=6, the five smallest elements of the set are:11, 33(11is in this set, so1⋅a=31⋅a=3is ...

2022-01-23 13:25:05 792

原创 Balance the Bits

A sequence of brackets is called balanced if one can turn it into a valid math expression by adding characters '+' and '1'. For example, sequences '(())()', '()', and '(()(()))' are balanced, while ')(', '(()', and '(()))(' are not.You are given a binary

2022-01-21 12:14:20 607

原创 Monsters And Spells

Monocarp is playing a computer game once again. He is a wizard apprentice, who only knows a single spell. Luckily, this spell can damage the monsters.The level he's currently on containsnnmonsters. Theii-th of them appearskikiseconds after the start...

2022-01-20 20:06:29 395

空空如也

空空如也

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

TA关注的人

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