自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Sean

走好选择的路,别选择好走的路,你才能拥有真正的自己!

  • 博客(25)
  • 收藏
  • 关注

原创 hdu 1754 I Hate It 【线段树 应用类型二 单点更新 区间最值】【模板】

题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1754 Problem Description 很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩...

2018-12-31 10:54:53 123

原创 hdu 2838 Cow Sorting (树状数组+逆序对变形)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2838 Problem Description Sherlock's N (1 ≤ N ≤ 100,000) cows are lined up to be milked in the evening. Each cow has a unique "grumpiness" level ...

2018-12-30 21:33:47 203

原创 hdu 2689 Sort it (树状数组应用类型三) 【逆序数问题】

Problem Description You want to processe a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. Then how many times it ne...

2018-12-30 20:24:27 189

原创 hdu1556 Color the ball (树状数组应用类型二) 【区间更新 单点求值】

题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1556 Problem Description N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几...

2018-12-30 17:14:33 141

原创 敌兵布阵 (树状数组应用类型一)【单点更新与区间求和】

题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1166 Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每...

2018-12-30 15:55:55 111

原创 Educational Codeforces Round 56 (Rated for Div. 2) A. Dice Rolling 签到题(思维题)

Mishka got a six-faced dice. It has integer numbers from 22 to 77 written on its faces (all numbers on faces are different, so this is an almostusual dice).Mishka wants to get exactly xx points by r...

2018-12-30 12:39:33 228

转载 快速幂

试题        求a^b的后三位数。a,b是整数。        这题也就是计算a^b%1000的值。解法一      &am

2018-12-30 12:17:45 155

转载 vector详解

在c++中,vector是一个十分有用的容器。作用:它能够像容器一样存放各种类型的对象,简单地说,vector是一个能够存放任意类型的动态数组,能够增加和压缩数据。vector在C++标准模板库中的部分内容,它是一个多功能的,能够操作多种数据结构和算法的模板类和函数库。特别注意:使用vector需要注意以下几点:1、如果你要表示的向量长度较长(需要为向量内部保存很多数),容易导致内存泄漏,而且效率...

2018-12-30 12:07:43 241

原创 Codeforces Round #529 (Div. 3)

A. Repeating CipherPolycarp loves ciphers. He has invented his own cipher called repeating.Repeating cipher is used for strings. To encrypt the string s=s1s2…sms=s1s2…sm (1≤m≤101≤m≤10), Polycarp u...

2018-12-30 11:45:07 233

原创 Avito Cool Challenge 2018 A. Definite Game

Chouti was doing a competitive programming competition. However, after having all the problems accepted, he got bored and decided to invent some small games.He came up with the following game. The p...

2018-12-22 17:45:07 228

原创 12\20

1.前天晚上的codeforce div3的感觉难度好大,打完都说除了前两道后面的至少div2难度,前两道题快速AC后面的D题看了好久wr几发,也没改出来,补了题才知道是思维+stack的巧妙使用。2.昨晚的比赛还没有补题,自己现在做题看到有思路的就一直写不放,很长时间还不能出的话其他的也就不想写了。3.通过打比赛复习学过的内容或接触新的知识也是挺不错的,以后多多比赛。4.这几天还在看...

2018-12-20 22:19:43 127

转载 字符串--------KMP算法(studying)

原 初识kmp算法(呕心沥血之文----看视频+总结) 2018年08月10日 15:57:08 _奶酪 阅读数:72更多 <div class="tags-box space"> <sp...

2018-12-20 19:41:56 6020

转载 字符串 -------------KMP算法(研究总结,字符串)

原文地址:http://www.cnblogs.com/SYCstudio/p/7194315.html KMP算法(研究总结,字符串) KMP算法(研究总结...

2018-12-20 19:23:33 184

原创 Codeforces Round #527 (Div. 3) D2. Great Vova Wall (Version 2)

Vova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. Now it's totally up to Vova to put the finishing touches.Th...

2018-12-20 17:31:44 161

原创 Codeforces Round #527 (Div. 3) D1. Great Vova Wall (Version 1) 【stack实现+复习】

随便复习下stack的基础操作:stack作为一个栈先进后出(后进先出),在#include<stack>头文件内。定义:stack<int>stk;当然也可以定义为其他的类型三个接口函数:push()将元素放入stack'中pop() 删除栈顶元素top()返回栈顶元素size()返回stack'的长度empty()判断stack是否为空...

2018-12-20 16:38:02 224

原创 Codeforces Round #527 (Div. 3) B. Teams Forming

B. Teams Formingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are nn students in a university. The number of students is ...

2018-12-20 15:57:29 227

原创 Codeforces Round #527 (Div. 3) A. Uniform String

A. Uniform Stringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers nn and kk.Your task is to construct...

2018-12-20 15:51:12 252

原创 Bellman_Ford算法 【模板及变形】【最小生成树与最短路的理解】【模板】

总结一下最小生成树与单源最短路的区别:最小生成树:找最小的连通路径使每个节点都可以直接或者间接的连通起来。可以通过prime算法枚举各个点,并通过松弛操作(注意与dijkstra松弛时的区别,一个是到最小生成树的整体最短路,一个是到源点的最短路)实现。也可以用kruskal算法通过将边进行排序后从小到大枚举边实现,在从小到大枚举边时需要通过并查集判断边之间是否已经连接。单源最短路:从某一个...

2018-12-13 21:04:13 265

原创 图论---------------最短路问题 【Dijkstra 】模板

Dijkstra算法:深入理解 Dijkstra 算法实现原理(理解Dijkstra算法的原理,模板还是套用刘汝佳的模板)适用于边权为正的情况,可用于计算正权图上的单元最短路(SSSP),即从单个源点出发,到所有节点的最短路,该算法同时适用于有向图和无向图。模板代码:struct Edge{ int from,to,dist; Edge(int f,int t,in...

2018-12-11 21:31:49 234

原创 java 测试题 回文子串 和 字符串数组排序问题

代码思路仅供参考,后来又重敲的未经评测总时间限制:1000ms内存限制:65536kB描述给定一个字符串,输出所有长度至少为2的回文子串。回文子串即从左往右输出和从右往左输出结果是一样的字符串,比如:abba,cccdeedccc都是回文字符串。输入一个字符串,由字母或数字组成。长度500以内。输出输出所有的回文子串,每个子串一行。子串长度小的优先输出...

2018-12-11 05:49:31 458

原创 POJ - 3617 Best Cow Line 水题

DescriptionFJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his cows in a line and herds them past the judges.The...

2018-12-06 23:56:32 154

原创 Educational Codeforces R ound 55 (Rated for Div. 2) B. Vova and Trophies

Vasya is reading a e-book. The file of the book consists of nn pages, numbered from 11to nn. The screen is currently displaying the contents of page xx, and Vasya wants to read the page yy. There are ...

2018-12-06 23:51:21 145

转载 【经典算法】Bellman-Ford最短路径算法 【原理理解】

[转自](https://blog.csdn.net/sms0101/article/details/73088422)单源最短路径给定一个图,和一个源顶点src,找到从src到其它所有所有顶点的最短路径,图中可能含有负权值的边。Dijksra的算法是一个贪婪算法,时间复杂度是O(VLogV)(使用最小堆)。但是迪杰斯特拉算法在有负权值边的图中不适用,Bellman-Ford适合这样的图。...

2018-12-04 21:34:48 2382

原创 图论------------还是畅通工程 最小生成树(Prime +Kruskal) 模板题

关于Prime的思想理解:   Prime算法的思想是枚举各个点能到达的所有的路,找出他们之间最短的,首先选择一个顶点加入生成树,然后找出一条边加入到生成树,重复n-1次,把所有的顶点都加入到生成树中,在这个算法里面也需要一个dis数组,不过它和迪杰斯特拉算法的不同之处在于,迪杰斯特拉的思想是dis[i]表示从1到i点的最小距离,而在Prime算法中,dis[i]代表每个项...

2018-12-02 16:33:06 231

原创 POJ 2739Sum of Consecutive Prime Numbers【素数判断+尺取法】

Sum of Consecutive Prime NumbersTime Limit: 1000MS   Memory Limit: 65536K Total Submissions: 28491   Accepted: 15275 DescriptionSome positive integers can be represented by a sum o...

2018-12-02 13:23:33 211

空空如也

空空如也

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

TA关注的人

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