自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 leetcode - gas station

There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its...

2014-10-02 21:45:03 191

原创 51nod-1050 循环最大字段和

N个整数组成的循环序列a[1],a[2],a[3],…,a[n],求该序列如a[i]+a[i+1]+…+a[j]的连续的子段和的最大值(循环序列是指n个数围成一个圈,因此需要考虑a[n-1],a[n],a[1],a[2]这样的序列)。当所给的整数均为负数时和为0。例如:-2,11,-4,13,-5,-2,和最大的子段为:11,-4,13。和为20。 Input第1行:整数...

2014-04-12 23:42:40 116

原创 51nod-1101 换零钱

时间限制:1 秒 空间限制:65536 KB 分值: 20N元钱换为零钱,有多少不同的换法?币值包括1 2 5分,1 2 5角,1 2 5 10 20 50 100元。 例如:5分钱换为零钱,有以下4种换法:1、5个1分2、1个2分3个1分3、2个2分1个1分4、1个5分(由于结果可能会很大,输出Mod 10^9 + 7的结果)Input输入1个数N,...

2014-04-12 23:32:36 160

原创 boj 11

Description We are familiar with the game called “Counting 24”. Now it comes a problem that we want to know whether we can figure out the exact answer with given 4 numbers only using +,-,*,/ and ...

2013-05-07 16:27:20 85

原创 boj 342

Descriptionxiaoming实在太好管闲事了.有一天他去参加一个舞会,这里聚集了一大堆帅哥美女,但是舞会却不是那么顺利,虽然帅哥和美女的人数都是相同的,但并不是每一位帅哥都能找到他的舞伴,原因就是有些女生只愿意接受某些男生的邀请.小明为了舞会的顺利进行,xiaoming只好厚着脸皮去和这些女生搭话,了解到了这些女生就都愿意接受哪些男生的邀请,那么剩下的工作就是要小明给这些帅哥美女们搭搭...

2013-05-07 00:30:45 110

原创 boj 343

DescriptionTradia最近去了趟超市,采购了好多好吃的东西,其中花花绿绿的巧克力最是诱人。为了感谢Jim前段时间对自己的帮助,Tradia决定把自己的巧克力分一些给Jim。但是Tradia也爱吃巧克力,她不想把自己全部的巧克力都给Jim,而是把巧克力平均分配,使得给Jim的总量和留给自己的总量之差最小。聪明的你能帮助她吗?Input输入包含多组测试数据。首先第一行输入一个数T(T&l...

2013-05-06 13:19:38 93

原创 boj 347

DescriptionTradia对数据结构很感兴趣,她懂得很多有用的数据结构,比如链表、二叉树、图等等。最近她在学习堆的有关知识,并对堆能够在log2N的时间复杂度内返回当前集合的最值感到十分的满意。可是我们都知道,Tradia是一个求知欲很强的学生,她并不满足于得到集合的最值(最大、最小值),同时她还想获得集合当前的第K小数,并且要求每次查询的复杂度要与log2N相当,如果复杂度比log2N...

2013-05-06 00:10:38 104

原创 boj 586

 [Description] Teoy最近迷上了阿里巴巴面向网商和中小企业主开发的BNS(Business Network Service)网站“来往”(www.laiwang.com),在那里他可以结交生意上的朋友,包括上游供应商以及下游的客户。随着业务的扩大,Teoy迫切想认识自己好友列表之外的更多的同行。他提出这样一个问题,给出任意的A和B,他想知道在“来往”上A能不能...

2013-05-06 00:08:45 143

原创 boj 437

Description校内赛马上开始了,选手们比赛时,需要打印代码,但是912的打印机被wangkun弄坏了,无法进行打印。wangkun的钱都上交给wmz了,他只有想办法让912的小盆友们手抄代码,然后送给选手们。这里共有n份代码 ,编号1,2,…,n。每份代码有pi页。全部分给m个小盆友。每人分到顺序连续的若干份,每份代码只分给一人。 为了和谐,wangkun需要你,求一种方案,使每人分到的...

2013-05-06 00:07:15 93

原创 boj 164

Description古老的原始部落ACElite的居民们一直过着日出而做,日落而出的简单生活。酋长dalong为了改善大家的生活,研究出了一种新的无线通讯工具,便于大家之间相互交流。这需要架设多个基站进行通信。但由于各种原因,他无法保证这项技术是否成功,所以决定和champ测试一下。现在我们知道ACElite部落有n(n<=10000)个山头,每个山头都可以架设基站。但如果山头间的距...

2013-05-06 00:03:56 94

原创 boj 158

Description为了准备期末考试了,laprovence正被讨厌的数字逻辑搞的头昏脑胀,尤其后面的一堆乱七八糟的概念,简直不知所云@#~!*&~这不有道简单的题就把他给难住了,题目大意是这样的:给出n个发光二极管,每个二极管都有两种状态,亮(on)与灭(off),然后给出一组每两个二极管之间的约束关系,约束关系有以下3 种1)a and b 表示第a个与第b个二极管必须同时亮2)a...

2013-04-28 00:07:33 81

原创 boj 268

DescriptionA brand new sapper robot is able to neutralize mines in a rectangular region having integer height and width (N and M respectively). Before the robot begins its work it is placed near the ...

2013-04-27 21:21:33 95

原创 boj 237

DescriptionGreetings, Libras.一个不透明的袋子里装有若干个重量是1的小球, 袋子的重量忽略不计. 只知道小球的数量至少是1, 至多是N.现在给你一架天平, 你可以自己设计一套砝码, 即砝码的个数与每个砝码的重量都可以自由定义(每个砝码的重量必须是正整数). 要求不管袋子里有多少个小球, 都可以用这套砝码称出小球的确切数量. 称的次数不限. 每次使用天平只能获...

2013-04-27 21:09:39 105

原创 boj 378

Description对于一个集合S={1,2,3,...N}的任一排列a1、a2、a3、... aN,我们定义ai的逆序数为∑(aj>ai | j<i),即排在ai前的所有比ai大的数的个数。我们把每个数的逆序数按下标排出就构成排列a1、a2、a3、... aN的一个逆序排列。比如排列 3 1 2的逆序排列为1 1 0(从左往右依次是1的逆序数、2的逆序数、3的逆序数)。现在我们给...

2013-04-27 00:39:06 106

原创 boj 447

DescriptionLet’s play a stone removing game.Initially, n stones are arranged on a circle and numbered 1, …, n clockwise (Figure 1). You are also given two numbers k and m. From this state, remove sto...

2013-04-24 21:31:46 149

原创 boj 12

DescriptionBig Johnsson Trucks Inc. is a company specialized in manufacturing big trucks. Their latest model, the Godzilla V12, is so big that the amount of cargo you can transport with it is never l...

2013-04-24 15:39:21 213

原创 蛋疼......

果然大家都是一样蛋疼的

2013-04-23 21:49:09 129

原创 boj 510

DescriptionEmployees of Baidu like to play a game called Making Numbers. It goes like this: there are two players in the game, one is called little A, the other little B. There are some cards with a ...

2013-04-23 20:18:50 99

原创 boj 590

[Description]teoy和3230391在915机房里发现了一块尺寸为n*m的巧克力,两个人互不想让,于是他们打算通过游戏来把这块巧克力瓜分掉。规则是两个人轮流吃巧克力,每次吃掉一个方块的巧克力时,它右下方的巧克力方块都可以他被吃掉。但是,谁把左上角的方块吃掉,谁就必须请对方一个大果粒。并且两人都不能中途退出游戏。由于是3230391先发现的巧克力,所以3030391先吃巧克力。假...

2013-04-22 22:08:31 209

原创 boj 81

DescriptionCreating the stars is a boring job, the God also felt boring to do that. To make the creating more interesting, when created a star which had a mass value, the God put it at a position o...

2013-04-22 22:00:42 64

原创 boj 67

Description虽然没看过,但是ACMaryland知道这部电影,因为燕姿那首《我也很想他》。但今天我们不是要探讨这部电影,也不是这首歌,我们要来寻找自己的世界中心:-) 古人曾告诉我们,世界是平的。其实,每个人心中都有自己对世界的定义。经常看到一句话,我和你的世界,就像两条平行线,永远没有交集。于是,ACMaryland决定,定义这个虚拟世界为一条直线。 在这个世界里,ACMaryla...

2013-04-21 22:58:43 98

原创 boj 62

Description    champ最近发现了一种奇怪的数,这种数是由m个连续的x后面跟上n个连续的y组成的十进制数,形如xxx...xxxyyy...yyy并且满足条件(0 < x <= 9, 0 <= y <= 9, x!=y)。    由于这种数的特性,champ把这种数叫做二部数。    现在champ有一个正整数K,他希望找到一个最小的(x,y)二部数使...

2013-04-21 13:24:40 82

原创 boj 77

Problem DescriptionYou are given a number 1 ≤ N ≤ 50. Every ticket has its 2N-digit number. We call a ticket lucky, if the sum of its first N digits is equal to the sum of its last N digits. You ar...

2013-04-19 23:36:07 82

原创 boj 86

Description在遥远的艾泽拉斯大陆上,有一个十分崇拜数字的种族。他们认为万物都是由数字组成的,而且一切的数字最后都能变成一个单独的数码。比如数字S(1990)=1+9+9+0=19,S(19)=10,S(10)=1.有一天他们从一个废墟中找到一个远古的羊皮卷轴,上面写满了密密麻麻的数字,族长认为卷轴能预言种族的未来。但是他们无法解读卷轴,你能帮助他们么?Input一开...

2013-04-18 16:09:05 427

原创 boj 85

Description Once upon a time,there's a boy whose name is lili.He likes to create many wonderful things.One day, he happens to come to a beautiful garden.There he picks many pretty little stones.A...

2013-04-18 14:21:43 63

原创 boj 75

Problem DescriptionLich Sandro investigates the magic of fire. He is standing in the center of a huge square hall with floor space one million square kilometers. The floor of the hall is paved wi...

2013-04-17 11:22:12 118

原创 boj 320

 DescriptionRecently, Teoy bought some matches of different length. He knew that he could use these matches to form a triangle. But soon he got tired of it. Now he wanted to reckon the number ...

2013-04-15 22:11:24 66

原创 一些心得

感觉做事情还是不能盲目的去做,有时候也不能钻进去了,有时候退出来,全局来看,弄清楚每个事件之间的逻辑关系,挺有用,总之,细节和全局都要把握住...

2013-04-12 15:59:44 58

原创 boj 316

Descriptionykwd's password is a number sequence. Every number in this sequence is no less than 0 and no larger than 255, and without leading zeros. ykwd wrote his password down ,but he didn't add s...

2013-03-21 13:00:26 82

原创 boj 10

Description There are n cells in a sequence. You can use three kinds of colors, red , pink , green to paint these cells , one cell with only one kind of color . Promising that any two adjacent ce...

2013-03-18 19:58:36 132

原创 boj 672

DescriptionAs the title suggest, this problem is yet another boring stone game.There are N piles of stones, Alice and Bob take turns to take away stones from the game, Alice plays first. Each ti...

2013-03-04 23:38:39 121

原创 boj 302

题目是图片形式给出的,只能贴出地址:http://acm.bupt.edu.cn/onlinejudge/newoj/showProblem/show_problem.php?problem_id=302思路:对于区间[Li,Ri),按照Li排序,然后对于每个方块区间[Li,Ri),判断当前所有层中最右边的方块的Rk是否小于等于Li,如果存在,则将[Li,Ri)放入该层,如果不存在...

2013-03-01 18:16:36 73

原创 boj 321

Description   There is a positive integer N, and please give us the smallest root x of equation sqrt(N)=sqrt(x)-sqrt(y) when x and y are both positive integer.Input   There are several test cases ...

2013-02-28 19:11:11 96

原创 boj 7

DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N  (1 ≤ N ≤ 1,000)) planks of wood, each having some integer le...

2013-02-28 19:02:16 77

原创 boj 462

DescriptionJyc最近在学《现代交换原理》这门传说中的北京市精品课程。本来以为很简单,但晚上在做作业时就被一道题搞的很郁闷。交换单元是交换网络最基本的部件,其有M根入线和N根出线,它的功能就是将这M根入线上的数据按一定的规则交换到N根出线上。这个单元内部连线的不同就造成出线数据的不同,因此会有许多组合。比如说下面就是最简单的两种组合。当然这种连接有一定的规则。一根入线可以连到...

2013-02-21 19:48:49 126

原创 boj 196

DescriptionCC lives on the  tree which has N nodes.On every leaf of the tree there is an apple(leaf means there is only one branch connect this node ) .Now CC wants to get two apple ,CC can choose ...

2013-02-21 19:44:18 67

原创 boj 36

Fax machines use a form of compression based on run-length encoding. Run-length encoding (RLE)is a very simple form of data compression in which runs of data (that is, sequences in which the same dat...

2013-02-21 19:37:43 105

原创 boj 376

Descriptioncloudiris是个爱学习的好孩子,每天她都会记单词,可她一翻开单词书看到如此之多的单词就感到头疼,于是她想出了一个和别人不相同的记单词的方法。她把单词归类分成几组,每一组单词的开头几个字母都是相同的,现在她需要根据给出的这组单词找出每个单词的最短前缀来唯一的标识这个单词。例如: carburetor 和carbohydrate 的最短前缀分别是carbu和carbo ...

2013-02-21 18:29:43 96

原创 boj 377

Description相信大家都玩过成语接龙吧,现在我们来玩一个单词接龙的游戏。游戏是在一个单词表上进行的,我们定义单词B可以接在单词A后,当且仅当A是B的前缀且B不等于A。考察如下的单词表:i、in、ix、int,一共有i->in、i->ix、i->int、in->int共4种接法。现在给定一个单词表,求出这个单词表可以构成的最长单词串包含的单词个数。Input输入包...

2013-02-21 00:02:49 118

原创 boj 288

DescriptionAs is told by the olds, there is a wonderful land of girls and magic, which has a fantasy name —— Gensokyo.Today's Gensokyo is still peaceful. And a silly ice fairy Cirno wants to pla...

2013-02-19 00:47:37 74

空空如也

空空如也

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

TA关注的人

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