自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 python reduce 用法

reduce函数是Python内置函数引用:from functools import reduce函数语法: reduce(function, iterable[,initializer])函数参数含义如下:1、function 需要带两个参数,1个是用于保存操作的结果,另一个是每次迭代的元素。2、iterable 待迭代处理的集合3、initializer 初始值,可以没有。r...

2019-12-02 15:54:33 523 1

转载 python lambda用法

转自:https://blog.csdn.net/zjuxsl/article/details/79437563一个语法在Python中,lambda的语法是唯一的。其形式如下:lambda argument_list: expression其中,lambda是Python预留的关键字,argument_list和expression由用户自定义。具体介绍如下。这里的argument_...

2019-12-02 15:29:26 176

原创 cin.get(),cin.get(ch),cin>>ch 的基本区别

cin>>ch 读取字符将忽略空格,换行符,和制表符,而cin.get()则不 cin.get(ch)成员函数调用通过返回转换为false的bool值来指出已到达EOF,而cin.get()成员函数调用则通过返回EOF值来指出已到达EOF,EOF是文件iostream中定义的。

2018-01-25 15:28:37 1289

原创 hdu 1026 Ignatius and the Princess I (带路径的搜索)

Problem DescriptionThe Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has to rescue our pretty Princess. Now he gets into feng5166's castle. The castle is a large labyrint

2017-03-15 20:23:48 364

原创 hdu 1536 S-Nim (博弈)

Problem DescriptionArthur and his sister Caroll have been playing a game called Nim for some time now. Nim is played as follows:  The starting position has a number of heaps, all containing

2017-03-14 16:50:24 370

原创 博弈之SG函数(详解为什么异或可以得出结果)

给定一个有向无环图和一个起始顶点上的一枚棋子,两名选手交替的将这枚棋子沿有向边进行移动,无法移 动者判负。事实上,这个游戏可以认为是所有Impartial Combinatorial Games的抽象模型。也就是说,任何一个ICG都可以通过把每个局面看成一个顶点,对每个局面和它的子局面连一条有向边来抽象成这个“有向图游戏”。下 面我们就在有向无环图的顶点上定义Sprague

2017-03-13 20:40:57 1929 1

原创 hdu 1848 Fibonacci again and again (博弈)

Problem Description任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的:F(1)=1;F(2)=2;F(n)=F(n-1)+F(n-2)(n>=3);所以,1,2,3,5,8,13……就是菲波那契数列。在HDOJ上有不少相关的题目,比如1005 Fibonacci again就是曾经的浙江省赛题。今天,

2017-03-13 19:52:39 241

原创 hdu 4911 Inversion (归并排序)

Problem Descriptionbobo has a sequence a1,a2,…,an. He is allowed to swap two adjacent numbers for no more than k times.Find the minimum number of inversions after his swaps.Note: The numbe

2017-03-11 21:34:09 233

原创 poj 2947 Widget Factory (高斯消元法,解模线性方程组)

DescriptionThe widget factory produces several different kinds of widgets. Each widget is carefully built by a skilled widgeteer. The time required to build a widget depends on its type: the simpl

2017-03-09 21:45:22 216

原创 poj 3185 The Water Bowls (高斯消元法)

DescriptionThe cows have a line of 20 water bowls from which they drink. The bowls can be either right-side-up (properly oriented to serve refreshing cool water) or upside-down (a position which h

2017-03-08 21:52:12 302

原创 poj 1830 开关问题(高斯消元法)

Description有N个相同的开关,每个开关都与某些开关有着联系,每当你打开或者关闭某个开关的时候,其他的与此开关相关联的开关也会相应地发生变化,即这些相联系的开关的状态如果原来为开就变为关,如果为关就变为开。你的目标是经过若干次开关操作后使得最后N个开关达到一个特定的状态。对于任意一个开关,最多只能进行一次开关操作。你的任务是,计算有多少种可以达到指定状态的方法。(不计开关操作的顺序

2017-03-08 20:15:32 234

原创 poj 1753 Flip Game (枚举+高斯消元法)

DescriptionFlip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying

2017-03-08 12:03:31 255

原创 poj 1681 Painter's Problem(高斯消元法)

DescriptionThere is a square wall which is made of n*n small square bricks. Some bricks are white while some bricks are yellow. Bob is a painter and he wants to paint all the bricks yellow. But th

2017-03-07 20:24:36 273

转载 高斯消元法模板

//这里提供下自己写的还算满意的求解整数线性方程组的模板(浮点数类似,就不提供了)~~/* 用于求整数解得方程组. */#include #include #include using namespace std;const int maxn = 105;int equ, var; // 有equ个方程,var个变元。增广阵行数为equ, 分别为0到equ - 1,列数为var +

2017-03-06 21:40:04 259

原创 poj 1222 EXTENDED LIGHTS OUT (高斯消元法)

DescriptionIn an extended version of the game Lights Out, is a puzzle with 5 rows of 6 buttons each (the actual puzzle has 5 rows of 5 buttons each). Each button has a light. When a button is pres

2017-03-06 21:35:37 334

原创 hdu 4115 Eliminate the Conflict (2-sat)

Problem DescriptionConflicts are everywhere in the world, from the young to the elderly, from families to countries. Conflicts cause quarrels, fights or even wars. How wonderful the world will be

2017-03-03 16:28:11 242

原创 hdu 3678 Katu Puzzle (2-sat)

DescriptionKatu Puzzle is presented as a directed graph G(V, E) with each edge e(a, b) labeled by a boolean operator op (one of AND, OR, XOR) and an integer c (0 ≤ c ≤ 1). One Katu is solvable i

2017-03-02 21:19:06 279

原创 poj 1648 Wedding (2-sat)

DescriptionUp to thirty couples will attend a wedding feast, at which they will be seated on either side of a long table. The bride and groom sit at one end, opposite each other, and the bride wea

2017-03-02 16:40:28 238

原创 poj 2296 Map Labeler (2-sat +二分)

DescriptionMap generation is a difficult task in cartography. A vital part of such task is automatic labeling of the cities in a map; where for each city there is text label to be attached to its

2017-03-01 11:39:09 260

原创 poj 3207 Ikki's Story IV - Panda's Trick (2-sat)

Descriptionliympanda, one of Ikki’s friend, likes playing games with Ikki. Today after minesweeping with Ikki and winning so many times, he is tired of such easy games and wants to play another

2017-02-28 20:19:56 351

原创 hdu1814 Peaceful Commission(2-sat)

Problem DescriptionThe Public Peace Commission should be legislated in Parliament of The Democratic Republic of Byteland according to The Very Important Law. Unfortunately one of the obstacles is

2017-02-28 18:10:45 333

原创 hdu 3622 Bomb Game(二分+2-sat)

Problem DescriptionRobbie is playing an interesting computer game. The game field is an unbounded 2-dimensional region. There are N rounds in the game. At each round, the computer will give Robbie

2017-02-28 13:45:44 191

原创 hdu1824 Let's go home (2-sat)

Problem Description小时候,乡愁是一枚小小的邮票,我在这头,母亲在那头。                        —— 余光中集训是辛苦的,道路是坎坷的,休息还是必须的。经过一段时间的训练,lcy决定让大家回家放松一下,但是训练还是得照常进行,lcy想出了如下回家规定,每一个队(三人一队)或者队长留下或者其余两名队员同时留下;每一对队员,如果队员A留下,

2017-02-26 15:36:30 289

原创 poj 1787

DescriptionCharlie is a driver of Advanced Cargo Movement, Ltd. Charlie drives a lot and so he often buys coffee at coffee vending machines at motorests. Charlie hates change. That is basically th

2017-02-24 21:52:36 202

原创 poj 2392 Space Elevator (多重背包)

DescriptionThe cows are going to space! They plan to achieve orbit by building a sort of space elevator: a giant tower of blocks. They have K (1 <= K <= 400) different types of blocks with which t

2017-02-23 20:34:00 197

原创 poj 1276 Cash Machine (多重背包)

DescriptionA Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N distinct bill denominat

2017-02-23 12:03:57 180

原创 hdu 3466 Proud Merchants (01背包)

Problem DescriptionRecently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a result, the people in this country are still ver

2017-02-23 10:44:03 222

原创 poj 2923 Relocation (01背包+状态压缩)

DescriptionEmma and Eric are moving to their new house they bought after returning from their honeymoon. Fortunately, they have a few friends helping them relocate. To move the furniture, they onl

2017-02-21 21:30:08 252

原创 hdu2639 Bone Collector II (01背包第k大解)

Problem DescriptionThe title of this problem is familiar,isn't it?yeah,if you had took part in the "Rookie Cup" competition,you must have seem this title.If you haven't seen it before,it doesn't m

2017-02-20 21:31:43 306

原创 poj 2184 Cow Exhibition (01背包)

Description"Fat and docile, big and dumb, they look so stupid, they aren't much fun..." - Cows with Guns by Dana Lyons The cows want to prove to the public that they are both smart and fun

2017-02-11 00:28:17 203

原创 hdu 1963 Investment (完全背包)

Problem DescriptionJohn never knew he had a grand-uncle, until he received the notary’s letter. He learned that his late grand-uncle had gathered a lot of money, somewhere in South-America, and th

2017-02-06 22:19:50 219

转载 分组背包

问题有N件物品和一个容量为V的背包。第i件物品的费用是c[i],价值是w[i]。这些物品被划分为若干组,每组中的物品互相冲突,最多选一件。求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最大。算法这个问题变成了每组物品有若干种策略:是选择本组的某一件,还是一件都不选。也就是说设f[k][v]表示前k组物品花费费用v能取得的最大权值,则有:f[k][v]=max

2017-02-06 19:35:59 215

原创 hdu 4341 Gold miner (分组背包)

Problem DescriptionHomelesser likes playing Gold miners in class. He has to pay much attention to the teacher to avoid being noticed. So he always lose the game. After losing many times, he wants

2017-02-06 19:34:29 267

原创 hdu 3183 A Magic Lamp(RMQ)

Problem DescriptionKiki likes traveling. One day she finds a magic lamp, unfortunately the genie in the lamp is not so kind. Kiki must answer a question, and then the genie will realize one of her

2017-01-10 10:24:38 213

原创 hdu 1806 Frequent values (RMQ)

Problem DescriptionYou are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are given several queries consisting of indices i and j (1 ≤ i ≤ j ≤

2017-01-08 22:30:33 287

原创 hdu 1542 Atlantis(线段树 线性扫描)

Problem DescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, t

2017-01-03 10:06:24 194

原创 hdu 1541 Stars (线段树)

Problem DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars tha

2016-12-22 15:59:44 250

原创 hdu 1540 Tunnel Warfare(区间合并)

Problem DescriptionDuring the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels la

2016-12-22 10:09:15 188

原创 hdu2141 (二分)

Problem DescriptionGive you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj+C

2016-11-29 21:02:51 343

原创 poj 2528 Mayor's posters(线段树+离散化)

DescriptionThe 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 counci

2016-11-13 17:35:52 265

空空如也

空空如也

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

TA关注的人

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