自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

xiang_hehe的博客

革命尚未成功,同志必须努力

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

原创 牛客练习赛25B——最长区间【线段树,思维,模拟】

链接:https://www.nowcoder.com/acm/contest/158/B来源:牛客网 题目描述给你一个长度为 n 的序列 a ,求最长的连续的严格上升区间的长度。同时会进行 m 次修改,给定 x , y ,表示将 ax 修改为 y ,每次修改之后都要求输出答案。输入描述:第一行 2 个数 n,m,表示序列长度,修改次数; 接下来一行 n 个数表示 ;...

2018-08-25 17:06:19 238

原创 牛客练习赛25A——因数个数和【数论】

链接:https://www.nowcoder.com/acm/contest/158/A来源:牛客网 q次询问,每次给一个x,问1到x的因数个数的和。输入描述:第一行一个正整数q ;接下来q行,每行一个正整数 x输出描述:共q行,每行一个正整数表示答案示例1输入复制412310输出复制13527说明1的因数...

2018-08-25 16:55:00 212

原创 51nod1126—— 求递推序列的第N项【矩阵快速幂】

1126 求递推序列的第N项 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题 收藏 关注有一个序列是这样定义的:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.给出A,B和N,求f(n)的值。Input输入3个数:A,B,N。数字之间用空格分割。(-100...

2018-08-25 16:52:03 166

原创 51nod1005 ——大数加法【高精度】

1005 大数加法 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注给出2个大整数A,B,计算A+B的结果。Input第1行:大数A第2行:大数B(A,B的长度 <= 10000 需注意:A B有可能为负数)Output输出A + BInput示例68932147586468711654886Ou...

2018-08-24 11:22:15 250

原创 POJ3468——A Simple Problem with Integers【线段树区间更新求和】

You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the ...

2018-08-22 23:16:52 106

原创 HDU1166——敌兵布阵【线段树】

Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。...

2018-08-22 23:13:23 167

原创 HDU1754——I Hate It【线段树,单点更新】

Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。  Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0<...

2018-08-22 23:09:28 103

原创 POJ2752——Seek the Name, Seek the Fame 【KMP】

 The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the same time seek...

2018-08-18 23:14:19 137

原创 HDU1686——Oulipo 【字符串HASH,KMP】

The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’...

2018-08-18 22:46:46 184

原创 POJ - 1751——Highways【最小生成树】

DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem and has already const...

2018-08-17 22:33:29 164

原创 HDU3635——Dragon Balls 【并查集】

Five hundred years later, the number of dragon balls will increase unexpectedly, so it's too difficult for Monkey King(WuKong) to gather all of the dragon balls together. His country has N cities...

2018-08-15 23:32:21 188

原创 HDU1385——Minimum Transport Cost 【Floyd,最短路打印路径】

These are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there is some cargo that should be delivered from one city to another. The transpor...

2018-08-15 23:16:10 133

原创 洛谷P1064——金明的预算方案【01背包】

题目描述金明今天很开心,家里购置的新房就要领钥匙了,新房里有一间金明自己专用的很宽敞的房间。更让他高兴的是,妈妈昨天对他说:“你的房间需要购买哪些物品,怎么布置,你说了算,只要不超过 NN 元钱就行”。今天一早,金明就开始做预算了,他把想买的物品分为两类:主件与附件,附件是从属于某个主件的,下表就是一些主件与附件的例子:主件 附件电脑 打印机,扫描仪书柜 图书书桌 台灯,文具...

2018-08-14 23:54:31 189

原创 Dividing coins 【01背包】

It's commonly known that the Dutch have invented copper-wire. Two Dutch men were fighting over a nickel, which was made of copper. They were both so eager to get it and the fighting was so fierce, the...

2018-08-11 23:38:35 142

原创 POJ1742——Coins 【多重背包可行性】

给出硬币面额及每种硬币的个数,求从1到m能凑出面额的个数。 Input多组数据,每组数据前两个数字为n,m。n表示硬币种类数,m为最大面额,之后前n个数为每种硬币的面额,后n个数为相应每种硬币的个数。 (n<=100,m<=100000,面额<=100000,每种个数<=1000)OutputRTSample Input3 101 2 4 2 1...

2018-08-11 23:27:52 209

原创 选美大赛 【LIS打印路径】

一年一度的哈理工选美大赛开始了.来自各个院系的N个美女们都在一起排成一排,然后从左到右给他们标号(1-N),评委叫兽开始观摩,由于身高高低都不同, 叫兽想从中选出尽可能多的人使得他们的身高从左到右依次递增,你能帮助叫兽吗?Input 输入数据第一行一个数据表示美女的个数N(0<N<100)接下来有N个数据表示1-N标号的美女的身高,身高范围都在0-180之内当N=0...

2018-08-11 23:20:21 177

原创 POJ2250——Compromise 【LCS打印路径】

In a few months the European Currency Union will become a reality. However, to join the club, the Maastricht criteria must be fulfilled, and this is not a trivial task for the countries (maybe except ...

2018-08-10 23:32:13 212

原创 51nod1006——最长公共子序列【LCS打印路径】

给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的)。比如两个串为: abcicbaabdkscab ab是两个串的子序列,abc也是,abca也是,其中abca是这两个字符串最长的子序列。Input第1行:字符串A第2行:字符串B(A,B的长度 <= 1000)Output输出最长的子序列,如果有多个,随意输出1个。In...

2018-08-10 23:27:55 259

原创 HDU1257——最少拦截系统【LIS】

某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统....

2018-08-09 23:00:24 123

原创 HDU1087——Super Jumping! Jumping! Jumping!【LIS】

Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to yo...

2018-08-09 22:55:58 144

原创 HDU1159——Common Subsequence【LCS】

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

2018-08-09 22:48:33 133

原创 HDU1114——Piggy-Bank【完全背包】

Piggy-BankTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 34373    Accepted Submission(s): 17037 Problem DescriptionBefore ACM can do an...

2018-08-08 23:40:57 200

原创 HDU2191——悼念512汶川大地震遇难同胞——珍惜现在,感恩生活 【多重背包】

Problem Description急!灾区的食物依然短缺!为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。请问:你用有限的资金最多能采购多少公斤粮食呢?后记:人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。月有阴晴圆缺,人有旦夕祸福...

2018-08-08 23:35:41 122

原创 HDU2546——饭卡【01背包】

饭卡Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 41815    Accepted Submission(s): 14310 Problem Description电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判...

2018-08-08 23:32:12 125

原创 HDU2602——Bone Collector【01背包问题】

Problem DescriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave ...

2018-08-08 23:26:15 163

原创 51nod1049——最大子段和【动态规划】

N个整数组成的序列a[1],a[2],a[3],…,a[n],求该序列如a[i]+a[i+1]+…+a[j]的连续子段和的最大值。当所给的整数均为负数时和为0。例如:-2,11,-4,13,-5,-2,和最大的子段为:11,-4,13。和为20。Input<span style="color:#000000"><span style="color:#303030"&...

2018-08-08 23:21:59 192

原创 HDU1260——Tickets【动态规划】

TicketsTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7775    Accepted Submission(s): 3952 Problem DescriptionJesus, what a great movie...

2018-08-08 23:09:01 228

原创 HDU - 4007——勇气【贪心,几何】

Recently, Dave is boring, so he often walks around. He finds that some places are too crowded, for example, the ground. He couldn't help to think of the disasters happening recently. Crowded place is ...

2018-08-04 23:51:53 138

原创 HDU6025——Coprime Sequence【数论,思维】

Coprime SequenceTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 3007    Accepted Submission(s): 1390 Problem DescriptionDo you know wh...

2018-08-04 23:43:27 181

原创 HDU - 1372 ——Knight Moves【BFS】

A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessboa...

2018-08-04 23:32:50 141

原创 LightOJ 1141—— Number Transformation【质因数分解,BFS】

In this problem, you are given an integer number s. You can transform any integer number A to another integer number B by adding x to A. This x is an integer number which is a prime factor of A (pleas...

2018-08-04 23:28:24 357

原创 poj1383——Labyrinth

Labyrinth Time Limit: 2000MS   Memory Limit: 32768K Total Submissions: 5189   Accepted: 1924 Description The northern part of the Pyramid contains a very ...

2018-08-04 23:22:55 147

原创 HDU2647——Reward【拓扑排序】

Reward Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 12986    Accepted Submission(s): 4143   Problem Description Dandelio...

2018-08-04 23:17:37 129

原创 HDU3342——Legal or Not【拓扑排序】

Legal or NotTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11067    Accepted Submission(s): 5185 Problem DescriptionACM-DIY is a large ...

2018-08-04 23:10:59 112

原创 poj2631——Roads in the North【树的直径】

Roads in the North Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3876   Accepted: 1914 Description Building and maintaining roads among com...

2018-08-04 23:05:47 216

原创 Equivalent Strings 【DFS】

Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are called equivalent in one of the two cases:They are equal. If we split...

2018-08-03 23:10:55 94

原创 CodeForces - 723D ——Lakes in Berland【DFS】

The map of Berland is a rectangle of the size n × m, which consists of cells of size 1 × 1. Each cell is either land or water. The map is surrounded by the ocean.Lakes are the maximal regions of wat...

2018-08-03 23:06:00 215

原创 POJ1321——棋盘问题【DFS】

棋盘问题Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 65039   Accepted: 31045 Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋...

2018-08-02 23:45:04 136

原创 POJ3984——迷宫问题【BFS,记录路径】

迷宫问题 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 33319   Accepted: 18985 Description 定义一个二维数组:  int maze[5][5] = { 0, 1, 0, 0, 0,...

2018-08-02 23:41:07 154

原创 CodeForces 510B——Fox And Two Dots【DFS】

Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n × m cells, like this:Each cell contains a dot that has some color. We will use differen...

2018-08-02 23:37:23 195

空空如也

空空如也

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

TA关注的人

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