自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 HAUTOJ 1268: 小天使改名

题目描述小天使的b站帐号被大家发现啦。于是小天使决定改名,将他原有ID中的两个不同位置的字母进行交换。(小天使有可能将两个不同位置的相同字母进行交换,虽然这样做他的ID并没有发生变化)Lsf知道小天使原来的ID,他想知道某个ID是否可能是小天使的新ID。 输入第一行为数据组数T(T≤100)。每组数据的第一行是字符串s1,(2≤length(s1)≤1000),为小

2017-04-23 21:03:41 1012

原创 fzu 2171 防守阵地 II(线段树 区间更新)

部队中总共有N个士兵,每个士兵有各自的能力指数Xi,在一次演练中,指挥部确定了M个需要防守的地点,指挥部将选择M个士兵依次进入指定地点进行防守任务,获得的参考指数即为M个士兵的能力之和。随着时间的推移,指挥部将下达Q个指令来替换M个进行防守的士兵们,每个参加完防守任务的士兵由于疲惫等原因能力指数将下降1。现在士兵们排成一排,请你计算出每次进行防守的士兵的参考指数。Input

2017-04-21 17:15:14 340

原创 FZU2167大王叫我来巡山呐

大师兄在取得真经后,每天详读经书,认真完成读书笔记,理论联系实际,不断提高实践能力。假设大师兄开始修炼的第一天是星期一,至今已经修炼了N天,那么有多少天是星期六或者星期日,大师兄还在修炼呢? Input  每组输入数据包含一个整数N(0 Output  对每组输入数据,输出一行,仅包含一个整数,表示这N天中是星期六或者星期日的天数。 Sample Inp

2017-04-21 14:29:51 501

原创 nyoj 891 找点

上数学课时,老师给了LYH一些闭区间,让他取尽量少的点,使得每个闭区间内至少有一个点。但是这几天LYH太忙了,你们帮帮他吗?输入多组测试数据。每组数据先输入一个N,表示有N个闭区间(N≤100)。接下来N行,每行输入两个数a,b(0≤a≤b≤100),表示区间的两个端点。输出输出一个整数,表示最少需要找几个点。样例输入41 52 41 42 331 23 45

2017-04-20 19:11:13 275

原创 nyoj 915 +-字符串

Shiva得到了两个只有加号和减号的字符串,字串长度相同。Shiva一次可以把一个加号和它相邻的减号交换。他想知道最少需要多少次操作才能把第一个字符串变换成第二个字符串。你现在要去帮助他完成那个这个问题。输入多组测试数据每组数据有两行,每行包含一个由”+”和”-“最成的字符串。每个子符串长度不超过5000。输出仅一个整数,输出最少需要操作的次数。如果答案不存在,输出-1。样例输入

2017-04-20 17:56:36 201

原创 zoj Robbers

N robbers have robbed the bank. As the result of their crime they chanced to get M golden coins. Before the robbery the band has made an agreement that after the robbery i-th gangster would get Xi=Y o

2017-04-20 16:25:25 297

原创 nyoj 115 城市平乱(spfa)

将军统领着N个部队,这N个部队分别驻扎在N个不同的城市。他在用这N个部队维护着M个城市的治安,这M个城市分别编号从1到M。现在,小工军师告诉南将军,第K号城市发生了暴乱,南将军从各个部队都派遣了一个分队沿最近路去往暴乱城市平乱。现在已知在任意两个城市之间的路行军所需的时间,你作为南将军麾下最厉害的程序员,请你编写一个程序来告诉南将军第一个分队到达叛乱城市所需的时间。注意,两个城

2017-04-19 15:54:29 336

原创 nyoj 42 24 Point game

There is a game which is called 24 Point game.In this game , you will be given some numbers. Your task is to find an expression which have all the given numbers and the value of the expression shoul

2017-04-19 14:41:06 222

原创 nyoj 1058 部分和问题

描述 给定整数a1、a2、.......an,判断是否可以从中选出若干数,使它们的和恰好为K。输入首先,n和k,n表示数的个数,k表示数的和。接着一行n个数。(1输出如果和恰好可以为k,输出“YES”,并按输入顺序依次输出是由哪几个数的和组成,否则“NO”样例输入4 131 2 4 7样例输出YES2 4 7#include#include#includ

2017-04-19 11:27:32 323

原创 nyoj 38 布线问题(prim)

描述 南阳理工学院要进行用电线路改造,现在校长要求设计师设计出一种布线方式,该布线方式需要满足以下条件:1、把所有的楼都供上电。2、所用电线花费最少输入第一行是一个整数n表示有n组测试数据。(n每组测试数据的第一行是两个整数v,e.v表示学校里楼的总个数(v随后的e行里,每行有三个整数a,b,c表示a与b之间如果建铺设线路花费为c(c随后的1行里,有v个整数,其中第

2017-04-19 09:32:27 319

原创 POJ - 3268 Silver Cow Party(spfa)

One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-way r

2017-04-18 21:34:59 269

原创 nyoj 488 && hdu 1016 素数环

素数环时间限制:1000 ms  |  内存限制:65535 KB难度:2描述 有一个整数n,把从1到n的数字无重复的排列成环,且使每相邻两个数(包括首尾)的和都为素数,称为素数环。为了简便起见,我们规定每个素数环都从1开始。例如,下图就是6的一个素数环。输入有多组测试数据,每组输入一个n(0输出每组第一行输出对应的Case序号,从1开始。如果存在满

2017-04-18 20:42:30 290

原创 ZOJ - 2316 Matrix Multiplication

Let us consider undirected graph G = which has N vertices and M edges. Incidence matrix of this graph is N * M matrix A = {aij}, such that a ij is 1 if i-th vertex is one of the ends of j-th edge an

2017-04-18 19:13:21 231

原创 ZOJ - 2313 Chinese Girls' Amusement

You must have heard that the Chinese culture is quite different from that of Europe or Russia. So some Chinese habits seem quite unusual or even weird to us.So it is known that there is one popular

2017-04-18 17:30:24 42344

原创 nyoj 58 最少步数

这有一个迷宫,有0~8行和0~8列: 1,1,1,1,1,1,1,1,1 1,0,0,1,0,0,1,0,1 1,0,0,1,1,0,0,0,1 1,0,1,0,1,1,0,1,1 1,0,0,0,0,1,0,0,1 1,1,0,1,0,1,0,0,1 1,1,0,1,0,1,0,0,1 1,1,0,1,0,0,0,0,1 1,1,1,1,1,1,1,1,1

2017-04-18 00:01:11 195

原创 HDU - 5007 Post Robot

DT is a big fan of digital products. He writes posts about technological products almost everyday in his blog.But there is such few comments of his posts that he feels depressed all the day. As

2017-04-17 22:17:36 270

原创 nyoj 一笔画问题

zyc从小就比较喜欢玩一些小游戏,其中就包括画一笔画,他想请你帮他写一个程序,判断一个图是否能够用一笔画下来。规定,所有的边都只能画一次,不能重复画。 输入第一行只有一个正整数N(N每组测试数据的第一行有两个正整数P,Q(P随后的Q行,每行有两个正整数A,B(0输出如果存在符合条件的连线,则输出"Yes",如果不存在符合条件的连线,输出"No"。样例输入24 3

2017-04-17 18:33:07 396

原创 HDU - 2112 HDU Today(spfa)

经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市�善终蛱找Υ迓蛄烁龇孔樱�开始安度晚年了。这样住了一段时间,徐总对当地的交通还是不太了解。有时很郁闷,想去一个地方又不知道应该乘什么公交车,在什么地方转车,在什么地方下车(其实徐总自己有车,却一

2017-04-17 16:34:42 321

原创 nyoj 21 三个水杯

给出三个水杯,大小不一,并且只有最大的水杯的水是装满的,其余两个为空杯子。三个水杯之间相互倒水,并且水杯没有标识,只能根据给出的水杯体积来计算。现在要求你写出一个程序,使其输出使初始状态到达目标状态的最少次数。输入第一行一个整数N(0接下来每组测试数据有两行,第一行给出三个整数V1 V2 V3 (V1>V2>V3 V10)表示三个水杯的体积。第二行给出三个整数E1 E2 E3 (体

2017-04-16 21:41:35 278

原创 HDU - 4460 Friend Chains (spfa)

For a group of people, there is an idea that everyone is equals to or less than 6 steps away from any other person in the group, by way of introduction. So that a chain of "a friend of a friend" can b

2017-04-16 16:46:17 316

原创 CodeForces - 165B Burning Midnight Oil

One day a highly important task was commissioned to Vasya — writing a program in a night. The program consists ofn lines of code. Vasya is already exhausted, so he works like that: first he writes

2017-04-16 11:53:08 239

原创 POJ - 1988 Cube Stacking

Farmer John and Betsy are playing a game with N (1 <= N <= 30,000)identical cubes labeled 1 through N. They start with N stacks, each containing a single cube. Farmer John asks Betsy to perform P (1<=

2017-04-16 10:43:00 194

原创 HDU - 1754 I Hate It

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

2017-04-15 10:04:45 132

原创 POJ - 3278 Catch That Cow

Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a pointN (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 10

2017-04-15 08:26:06 202

原创 nyoj 6 喷水装置(一)

现有一块草坪,长为20米,宽为2米,要在横中心线上放置半径为Ri的喷水装置,每个喷水装置的效果都会让以它为中心的半径为实数Ri(0<Ri<15)的圆被湿润,这有充足的喷水装置i(1<i<600)个,并且一定能把草坪全部湿润,你要做的是:选择尽量少的喷水装置,把整个草坪的全部湿润。输入第一行m表示有m组测试数据每一组测试数据的第一行有一个整数数n,n表示共有n个喷水装置,随后的一行,有n

2017-04-14 21:56:51 202

原创 HDU - 1728 逃离迷宫

给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有些地方是障碍,她必须绕行,从迷宫的一个位置,只能走到与它相邻的4个位置中,当然在行走过程中,gloria不能走到迷宫外面去。令人头痛的是,gloria是个没什么方向感的人,因此,她在行走过程中,不能转太多弯了,否则她会晕倒的。我们假定给定的

2017-04-14 21:30:15 215

原创 CodeForces - 301B Yaroslav and Time(弗洛伊德)

Yaroslav is playing a game called "Time". The game has a timer showing the lifespan he's got left. As soon as the timer shows 0, Yaroslav's character dies and the game ends. Also, the game hasn cloc

2017-04-14 20:56:13 494

原创 CodeForces - 208B Solitaire

A boy named Vasya wants to play an old Russian solitaire called "Accordion". In this solitaire, the player must observe the following rules:A deck of n cards is carefully shuffled, then alln car

2017-04-14 09:13:24 317

原创 hdu 1242 Rescue(广搜+优先队列)

Problem DescriptionAngel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M Angel's friends want to save Angel. Their task is: approach Angel. W

2017-04-13 21:23:28 190

原创 hdu 2723 Electronic Document Security

The Tyrell corporation uses a state-of-the-art electronic document system that controls all aspects of document creation, viewing, editing, and distribution. Document security is handled via access co

2017-04-13 21:05:35 475

原创 CodeForces - 520B Two Buttons

Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies th

2017-04-13 19:09:50 249

原创 nyoj 32 组合数

描述 找出从自然数1、2、... 、n(0<n<10)中任取r(0<r<=n)个数的所有组合。输入输入n、r。输出按特定顺序输出所有组合。特定顺序:每一个组合中的值从大到小排列,组合之间按逆字典序排列。样例输入5 3样例输出543542541532531521432431421321明显是要一个一个去放的,因为是要按照从大到小放,所以从大到小枚举,

2017-04-13 14:39:24 341

原创 CodeForces - 242C King's Path (广搜+STL)

The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from1 to 109 from top to bottom. The columns are s

2017-04-11 22:02:41 546

原创 HDU - 2354 Another Brick in the Wall (优先队列+BFS 记忆化)

After years as a brick-layer, you've been called upon to analyze the structural integrity of various brick walls built by the Tetrad Corporation. Insteadof using regular-sized bricks, the Tetrad C

2017-04-11 20:25:02 309

原创 hdu 2923 Einbahnstrasse

Problem DescriptionEinbahnstra e (German for a one-way street) is a street on which vehicles should only move in one direction. One reason for having one-way streets is to facilitate a smoother f

2017-04-11 10:51:09 222

原创 poj 2299 Ultra-QuickSort

DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the seque

2017-04-10 14:43:44 196

原创 树状数组求序列的区间和

给你一个序列,求任意区间的和。树状数组的思路:#include#include#includeusing namespace std; int n; int a[100]; int c[100];int lowbit(int x){return x&(-x);}void build(int p,int num){ while(p<=n){

2017-04-09 20:14:36 504

原创 nyoj 1277 Decimal integer conversion

XiaoMing likes mathematics, and he is just learning how to convert numbers between different bases , but he keeps making errors since he is only 6 years old. Whenever XiaoMing converts a number to a n

2017-04-06 15:59:14 153

原创 CodeForces - 544B Sea and Islands

A map of some object is a rectangular field consisting of n rows and n columns. Each cell is initially occupied by the sea but you can cover some some cells of the map with sand so that exactlyk i

2017-04-05 09:14:45 266

原创 poj 1308 Is It A Tree?

DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following proper

2017-04-04 20:54:19 152

空空如也

空空如也

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

TA关注的人

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