自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 go语言学习(二)

2.12 Go语言变量的生命周期变量的生命周期指的是在程序运行期间变量有效存在的时间间隔。对于在包一级声明的变量来说,它们的生命周期和整个程序的运行周期是一致的。而相比之下,局部变量的声明周期则是动态的:每次从创建一个新变量的声明语句开始,直到该变量不再被引用为止,然后变量的存储空间可能被回收。函数的参数变量和返回值变量都是局部变量。它们在函数每次被调用的时候创建。那么 Go语言的自动垃圾收集...

2019-07-10 21:08:46 288

原创 go语言学习(一)

安装 : liunx下安装go语言的特点引入包的概念,go语言的每一个文件都要属于一个包,不能单独存在引入垃圾回收机制,内存自动回收天然并发(支持大并发)从语言层面支持并发,实现简单从goroutine,轻量级线程,可实现大并发处理,高效利用多核基于CPS并发模型实现吸收管道通信机制,channel,可以实现不同goroutine的通信go函数可以支持返回...

2019-07-10 18:04:10 410

原创 TCP/IP网络编程

在github上记录了自己网络编程的学习https://github.com/msyyyy/TCP-IP-NetworkNote

2019-03-20 16:50:34 488

原创 基数排序

32位数字以内可以做到o( 2*n )将一个32位数分成前16位和后16位,先按后16位进行计数排序,要记录的是原数组和后16位排序后数组的对应关系,再按前16位进行计数排序什么是计数排序:有n个数,每个数范围在0 - k 以内,那我们建立一个 k大小的数组,先o ( n )统计每个数的个数,然后通过前项和我们可以知道大于等于这个数的个数,也能知道这个数在排序后数组的位置应该在哪...

2019-03-01 10:35:25 142

原创 图解红黑树

红黑树 : 平衡的二叉查找树 ,时间复杂度o(log(n)),任何插入或删除能在三次旋转以内平衡特性 :节点是红色或者黑色根节点是黑色每个叶子的节点都是黑色的空点节点每个红色节点的两个子节点都是黑色从任意节点到其每个叶子的所有路径都包含相同的黑色节点因为这些规则才能保证红黑树的自平衡,最长路径不超过最短路径的2倍红黑树是通过旋转来保证在添加或删除元素后依旧能维持红黑树性质的。...

2019-02-27 15:19:37 763

原创 nyoj 1530-riba2534的拷问2(模拟)

题目链接转眼就到了2018年的ACM集训队第二次招新,希望大家在本次比赛中取得好成绩!看标题名字就知道,历史总是惊人的相似,这个题目和上次招新赛的某道题很像,还是关于A+B问题的,题目是这样的:给出你一个表达式只包含’+’,’-'两种运算,然后你要输出对应结果的字符画形式。给出的表达式形式一定是形如:‘a+b’,‘a-b’,这种形式,并且保证a和b的范围都在0~9之内.具体的输入和输出...

2018-11-19 16:47:55 221

原创 hdu-1561 The more, The Better(树形背包)

题目链接 dp[ i ] [ j ] 代表第 i 个点 最多选 j 个子节点能获得的最大值显然除了根节点 0 其他的 i dp [ i ] [ 1 ]都是 选他自己#include <stdio.h>#include <algorithm>#include<string.h>#include<string>#include<i...

2018-11-16 11:09:06 122

原创 Frog and Portal HihoCoder - 1873 (二进制拆分)

A small frog wants to get to the other side of a river. The frog is initially located at one bank of the river (position 0) and wants to get to the other bank (position 200). Luckily, there are 199 le...

2018-11-14 20:57:40 393

原创 K-th Number hdu 6231(二分+尺取)

Alice are given an array A[1..N] with N numbers.Now Alice want to build an array B by a parameter K as following rules:Initially, the array B is empty. Consider each interval in array A. If the leng...

2018-11-14 11:48:53 137

原创 Snakes and Ladders LightOJ - 1151 (求期望 高斯消元)

'Snakes and Ladders' or 'Shap-Ludu' is a game commonly played in Bangladesh. The game is so common that it would be tough to find a person who hasn't played it. But those who haven't played it (unluck...

2018-11-12 16:11:28 390

原创 Race to 1 Again LightOJ - 1038 (期望)

Rimi learned a new thing about integers, which is - any positive integer greater than 1 can be divided by its divisors. So, he is now playing with this property. He selects a number N. And he calls th...

2018-11-10 18:48:37 100

原创 Snake Carpet UVALive - 7269 (构造)

In school of EECS of Peking University, there is a homework for all freshman — the contest of AIsnakes. This contest is ended today. Bacchus has got a very good result, so he decides to make a carpet...

2018-11-10 18:47:23 132

原创 Xiongnu's Land UVALive - 7261

Wei Qing (died 106 BC) was a military general of the Western Han dynasty whose campaigns againstthe Xiongnu earned him great acclaim. He was a relative of Emperor Wu because he was the youngerhalf-b...

2018-11-10 18:45:58 179

原创 Domination ZOJ - 3822 (概率dp 求期望)

Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorative chessboard with N rows and M columns.E...

2018-11-09 15:45:31 122

原创 String painter HDU - 2476 (区间dp)

There are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the painter, you can change a segment of chara...

2018-11-07 20:21:12 98

原创 G - B-number HDU - 3652 (数位dp)

A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string "13" and can be divided by 13. For example, 130 and 2613 are wqb-numbers, but 143 and 2639 ar...

2018-11-07 17:50:40 126

原创 Valley Numer HDU - 6148 (数位dp)

众所周知,度度熊非常喜欢数字。它最近发明了一种新的数字:Valley Number,像山谷一样的数字。当一个数字,从左到右依次看过去数字没有出现先递增接着递减的“山峰”现象,就被称作 Valley Number。它可以递增,也可以递减,还可以先递减再递增。在递增或递减的过程中可以出现相等的情况。比如,1,10,12,212,32122都是 Valley Number。121,123...

2018-11-07 11:19:24 296

原创 1026: [SCOI2009]windy数(数位dp)

1026: [SCOI2009]windy数Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 10739  Solved: 5051[Submit][Status][Discuss]Description  windy定义了一种windy数。不含前导零且相邻两个数字之差至少为2的正整数被称为windy数。 windy想知道,在A和B之间...

2018-11-06 20:34:18 171

原创 poj2528--Mayor's posters(线段树+离散化)

The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally d...

2018-11-05 20:25:21 106

原创 Dire Wolf HDU - 5115 (区间dp)

 Dire wolves, also known as Dark wolves, are extraordinarily large and powerful wolves. Many, if not all, Dire Wolves appear to originate from Draenor.Dire wolves look like normal wolves, but these...

2018-11-04 16:40:01 142

原创 Drazil and Tiles CodeForces - 515D

Drazil created a following problem about putting 1 × 2 tiles into an n × m grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover ...

2018-11-03 19:46:47 159

原创 Happy Necklace hdu 6030 (BM算法)

Little Q wants to buy a necklace for his girlfriend. Necklaces are single strings composed of multiple red and blue beads.Little Q desperately wants to impress his girlfriend, he knows that she will ...

2018-10-25 15:38:19 196

转载 A Dangerous Maze (II)

 https://blog.csdn.net/qq_31759205/article/details/54710164题解:期望dp,设正确的门有a个,平均耗时为sum1,错误的门有b个,平均耗时为sum2。状态转移分2部分:①当i==k时,即已经记住k次走错的门,②当i<k时,#include<bits/stdc++.h>using namespace ...

2018-10-22 16:16:13 142

原创 Batting Practice LightOJ - 1408

After being all out for 58 and 78 in two matches in the most prestigious tournament in the world, the coach of a certain national cricket team was very upset. He decided to make the batsmen practice a...

2018-10-19 11:11:10 152

原创 Lights inside 3D Grid LightOJ - 1284

题解:概率计数。因为是求期望值,考虑每个点对答案的贡献:对每个点是亮着的概率求和就是所求期望。那么每个点亮着的概率为多少呢?根据题意,对于点(x,y,z)只有当被选中的2个点(x1,y1,z1),(x2,y2,z2),满足x1<=x<=x2且y1<=y<=y2且z1<=z<=z2时,该点的状态才会改变,因此对于每一维,在区间内的概率=1-区间在该点的...

2018-10-17 18:37:29 113

原创 Beating the Dataset LightOJ - 1274

You are in a contest, and unfortunately you don't have much time. You have one problem in hand; you just glanced at the sample output and found that it just wants 'YES' or 'NO'. So, you have made anot...

2018-10-17 10:48:25 254

原创 Dice (III) LightOJ - 1248

Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see all its faces at least once. Assume that the dice is fair, that means when you throw the dic...

2018-10-14 19:52:46 107

原创 Birthday Paradox LightOJ - 1104

Sometimes some mathematical results are hard to believe. One of the common problems is the birthday paradox. Suppose you are in a party where there are 23 people including you. What is the probability...

2018-10-14 17:01:49 115

原创 Just another Robbery LightOJ - 1079(概率)

As Harry Potter series is over, Harry has no job. Since he wants to make quick money, (he wants everything quick!) so he decided to rob banks. He wants to make a calculated risk, and grab as much mone...

2018-10-13 20:33:56 104

原创 Race to 1 Again LightOJ - 1038

Rimi learned a new thing about integers, which is - any positive integer greater than 1 can be divided by its divisors. So, he is now playing with this property. He selects a number N. And he calls th...

2018-10-12 11:03:51 133

原创 洛谷 P2473 [SCOI2008]奖励关 (求期望的状压dp)

你正在玩你最喜欢的电子游戏,并且刚刚进入一个奖励关。在这个奖励关里,系统将依次随机抛出k次宝物,每次你都可以选择吃或者不吃(必须在抛出下一个宝物之前做出选择,且现在决定不吃的宝物以后也不能再吃)。宝物一共有n种,系统每次抛出这n种宝物的概率都相同且相互独立。也就是说,即使前k-1 次系统都抛出宝物1(这种情况是有可能出现的,尽管概率非常小),第k次抛出各个宝物的概率依然均为1/n。获取第 ...

2018-09-30 15:09:03 166

原创 hdu1667-IDA*-迭代加深搜索 A*算法

The rotation game uses a # shaped board, which can hold 24 pieces of square blocks (see Fig.1). The blocks are marked with symbols 1, 2 and 3, with exactly 8 pieces of each kind. Initially, the b...

2018-09-10 19:39:33 172

原创 Codeforces#86D Powerful array(莫队)

An array of positive integers a1, a2, ..., an is given. Let us consider its arbitrary subarray al, al + 1..., ar, where 1 ≤ l ≤ r ≤ n. For every positive integer s denote by Ks the number of occurrenc...

2018-09-01 18:13:39 133

原创 CodeForces 940F Machine Learning(带修改的莫队)

You come home and fell some unpleasant smell. Where is it coming from?You are given an array a. You have to answer the following queries:You are given two integers l and r. Let ci be the number of...

2018-09-01 11:10:37 193

原创 BZOJ2038 小Z的袜子 (莫队算法)

作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命……具体来说,小Z把这N只袜子从1到N编号,然后从编号L到R(L 尽管小Z并不在意两只袜子是不是完整的一双,甚至不在意两只袜子是否一左一右,他却很在意袜子的颜色,毕竟穿两只不同色的袜子会很尴尬。你的任务便是告诉小Z,他有多大的概率抽到两只颜色相同的...

2018-08-11 10:47:49 186

原创 CodeForces 253D Table with Letters

Vasya has recently started to learn English. Now he needs to remember how to write English letters. He isn't sure about some of them, so he decided to train a little.He found a sheet of squared pape...

2018-08-07 09:20:28 216

原创 CF372C Watching Fireworks is Fun(dp+单调队列优化)

A festival will be held in a town's main street. There are n sections in the main street. The sections are numbered 1 through n from left to right. The distance between each adjacent sections is 1.I...

2018-08-02 18:42:52 469

原创 Largest Rectangle in a Histogram (单调栈)

A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows ...

2018-08-02 09:20:59 335

转载 poj 1821 Fence(dp+单调队列优化)

FenceTime Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5830   Accepted: 1857 DescriptionA team of k (1 <= K <= 100) workers should paint a fence which contains N (...

2018-08-01 10:34:19 280

原创 hdu3530 单调队列

  There is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference between the maximum element and the minimum element of the su...

2018-07-18 11:42:29 151

空空如也

空空如也

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

TA关注的人

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