自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

白黑菜的博客

一起学习,不断进步。

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

原创 POJ 1738

There is an old stone game.At the beginning of the game the player picks n(1At each step of the game,the player can merge two adjoining piles to a new pile.The score is the number of stones in the n

2017-09-19 11:36:19 526 1

原创 ccf 游戏

试题编号:201604-4试题名称:游戏时间限制:1.0s内存限制:256.0MB问题描述:问题描述  小明在玩一个电脑游戏,游戏在一个n×m的方格图上进行,小明控制的角色开始的时候站在第一行第一列,目标是前往第n行第m列。  方格图上有一些方格是始终安全的,有一些在一段时间是危险的,如果小明控制的角色到达一个方格的时

2017-09-16 17:32:51 419

原创 ccf 交通规划

201609-4试题名称:交通规划时间限制:1.0s内存限制:256.0MB问题描述:问题描述  G国国王来中国参观后,被中国的高速铁路深深的震撼,决定为自己的国家也建设一个高速铁路系统。  建设高速铁路投入非常大,为了节约建设成本,G国国王决定不新建铁路,而是将已有的铁路改造成高速铁路。现在,请你为G国国王提供一个方案,

2017-09-16 15:42:02 591

原创 ccf 炉石传说

201609-3试题名称:炉石传说时间限制:1.0s内存限制:256.0MB问题描述:问题描述  《炉石传说:魔兽英雄传》(Hearthstone: Heroes of Warcraft,简称炉石传说)是暴雪娱乐开发的一款集换式卡牌游戏(如下图所示)。游戏在一个战斗棋盘上进行,由两名玩家轮流进行操作,本题所使用的炉石传说游戏的

2017-09-15 20:33:29 701

原创 string

#include#include#include#include#include#include #includeusing namespace std;int main(){ string x = "abc"; x[3] = '1'; cout x += x[3]; cout << x << endl; cout << x[3] << endl; r

2017-09-15 13:32:53 203

原创 ccf 权限查询

试题编号:201612-3试题名称:权限查询时间限制:1.0s内存限制:256.0MB问题描述:问题描述  授权 (authorization) 是各类业务系统不可缺少的组成部分,系统用户通过授权机制获得系统中各个模块的操作权限。  本题中的授权机制是这样设计的:每位用户具有若干角色,每种角色具有若干权限。例如,用户

2017-09-15 13:18:10 282

原创 ccf 修建地铁

问题描述试题编号:201703-4试题名称:地铁修建时间限制:1.0s内存限制:256.0MB问题描述:问题描述  A市有n个交通枢纽,其中1号和n号非常重要,为了加强运输能力,A市决定在1号到n号枢纽间修建一条地铁。  地铁由很多段隧道组成,每段隧道连接两个交通枢纽。经过勘探,有m段隧道作为候选,

2017-09-14 19:57:19 552

原创 树的直径 hdu 2196

仅供自己复习。另附网站 http://www.cnblogs.com/wuyiqi/archive/2012/04/08/2437424.html网站2: http://blog.csdn.net/y990041769/article/details/38121945#include #include #include #include #include

2017-09-07 22:26:27 244

原创 树的重心 poj-1655

紫书上的方法树的很明确,这里列举了一道例题,还有对这种类型的题目更高深的一些问题。首先,是poj-1655的一道裸题,也是入门类型的。#include#include#include#include#includeusing namespace std;int n;vector son[20010];int val[20010];int sum[20010];void

2017-09-06 18:10:06 297

原创 树的最大独立集 poj 2342

题目描述 Ural大学有N个职员,编号为1~N。他们有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结点的直接上司。每个职员有一个快乐指数。现在有个周年庆宴会,要求与会职员的快乐指数最大。但是,没有职员愿和直接上司一起参加宴会。输入 第一行一个整数N。(1≤N≤6000)接下来N行,第i+1行表示i号职员的快乐指数Ri。(-128≤Ri≤127)接

2017-09-06 10:20:18 339

原创 Faucet Flow UVA - 10366

主要就是模拟这题,实在是比较坑,个人代码写的很长,很无奈。大体要分情况讨论:1: 确定最终从哪一边流出,也就是先确定左边最高的板子和右边最高的板子哪一个更高。 如果相同高度的话就是左右两边都可能流出,那就取时间最短的那个。2:还有很多小细节,这个要自己做的时候慢慢想,做这种题还是很考验耐心的,因为没有什么算法,这也就不赘述了,具体过程还是自己慢慢体会吧。留个纪念,纪念这个坑

2017-08-17 14:51:24 254

原创 Game of the Rows CodeForces - 839B

Daenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains ai soldiers. She wants to bring her army to the other side of the sea to get the Iron Throne. She has recen

2017-08-16 00:31:45 270 1

原创 C - Keine's Problem OpenJ_POJ - 1039

In Gensokyo, Keine is a teacher in Human Village. Since there are many naughty students in her class, Keine keeps a log of all in/out behaviors of all students, in chronological order.Following is a

2017-08-14 21:53:55 211

原创 C. Journey(dfs求期望+Codeforces Round #428 (Div. 2))

C. Journeytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n cities and n - 1 roads in the Seven Kingdoms,

2017-08-14 12:51:58 406

原创 Little Tiger vs. Deep Monkey HDU - 4815 (dp)

A crowd of little animals is visiting a mysterious laboratory – The Deep Lab of SYSU. “Are you surprised by the STS (speech to speech) technology of Microsoft Research and the cat face recognition

2017-08-09 22:18:40 429

原创 Brackets sequence UVA - 1626(区间dp)

紫书278页的题目,纪念一下坑比的输入格式,实在是无语了;#include#include#include#includeusing namespace std;const int maxn = 100 + 5;char S[maxn];int n, d[maxn][maxn];bool match(char a, char b) { return (a == '('

2017-08-09 00:19:04 253

原创 Disk Schedule HDU - 4824 (双调欧几里得旅行商问题)

有很多从磁盘读取数据的需求,包括顺序读取、随机读取。为了提高效率,需要人为安排磁盘读取。然而,在现实中,这种做法很复杂。我们考虑一个相对简单的场景。 磁盘有许多轨道,每个轨道有许多扇区,用于存储数据。当我们想在特定扇区来读取数据时,磁头需要跳转到特定的轨道、具体扇区进行读取操作。为了简单,我们假设磁头可以在某个轨道顺时针或逆时针匀速旋转,旋转一周的时间是360个单位时间。磁头也可以随意移动到某

2017-08-08 21:40:04 227

原创 Labyrinth HDU - 4826 (dp)

度度熊是一只喜欢探险的熊,一次偶然落进了一个m*n矩阵的迷宫,该迷宫只能从矩阵左上角第一个方格开始走,只有走到右上角的第一个格子才算走出迷宫,每一次只能走一格,且只能向上向下向右走以前没有走过的格子,每一个格子中都有一些金币(或正或负,有可能遇到强盗拦路抢劫, 度度熊身上金币可以为负,需要给强盗写欠条),度度熊刚开始时身上金币数为0,问度度熊走出迷宫时候身上最多有多少金币? Input

2017-08-08 13:31:24 205

转载 CCNP ospf协议

OSPF(Open Shortest Path Fitst,ospf)开放最短路径优先协议,是由Internet工程任务组开发的路由选择协议,公用协议,任何厂家的设备。链路状态路由协议(也可以说OSPF)工作原理:每台路由器通过使用Hello报文与它的邻居之间建立邻接关系每台路由器向每个邻居发送链路状态通告(LSA),有时叫链路状态报文(LSP). 每个邻居在收到LSP之后要依次向它的

2017-08-08 12:16:54 348

原创 Dream City ZOJ - 3211 (动态规划)

JAVAMAN is visiting Dream City and he sees a yard of gold coin trees. There are ntrees in the yard. Let's call them tree 1, tree 2 ...and tree n. At the first day, each tree i has ai coins on it (i=1,

2017-08-05 19:19:03 425

原创 Connect them ZOJ - 3204 (最小生成树)

You have n computers numbered from 1 to n and you want to connect them to make a small local area network (LAN). All connections are two-way (that is connecting computers i and j is the same as connec

2017-08-05 19:07:34 213

原创 Codeforces Round #245 (Div. 1) -- B. Working out (DP)

Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix a with n lines and mcolumns. Let number a[i][j] represen

2017-07-21 22:41:01 366

原创 Magic Powder - 2 CodeForces - 670D2(二分)

The term of this problem is the same as the previous one, the only exception — increased restrictions.InputThe first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ 109

2017-07-18 10:13:50 339

原创 Connections in Galaxy War ZOJ - 3261

In order to strengthen the defense ability, many stars in galaxy allied together and built many bidirectional tunnels to exchange messages. However, when the Galaxy War began, some tunnels were destro

2017-07-16 19:42:17 303

原创 New Year and Old Property CodeForces - 611B

The year 2015 is almost over.Limak is a little polar bear. He has recently learnt about the binary system. He noticed that the passing year has exactly one zero in its representation in the binary s

2017-07-09 16:23:40 195

原创 Coprime Sequence HDU - 6025

Do you know what is called ``Coprime Sequence''? That is a sequence consists of nnpositive integers, and the GCD (Greatest Common Divisor) of them is equal to 1. ``Coprime Sequence'' is easy to fi

2017-07-09 12:16:12 327

原创 Color Length UVA - 1625

紫书上的题目,讲解的很清楚,附代,以后要仔细思考.#include#include#include#includeusing namespace std;int c[5010][5010];int dp[5010][5010];char s1[5010];char s2[5010];int p[5010];int q[5010];int py[5010];int qy[

2017-07-09 10:05:51 280

原创 Queue CodeForces - 141C

In the Main Berland Bank n people stand in a queue at the cashier, everyone knows his/her height hi, and the heights of the other people in the queue. Each of them keeps in mind number ai — how many

2017-07-07 08:42:07 632

原创 The Frog's Games HDU - 4004 (二分)

The annual Games in frogs' kingdom started again. The most famous game is the Ironfrog Triathlon. One test in the Ironfrog Triathlon is jumping. This project requires the frog athletes to jump over th

2017-07-06 10:48:48 256

原创 Alice and Bob HDU - 4268

Alice and Bob's game never ends. Today, they introduce a new game. In this game, both of them have N different rectangular cards respectively. Alice wants to use his cards to cover Bob's. The card A c

2017-07-06 08:42:41 571

原创 The Meeting Place Cannot Be Changed CodeForces - 782B (二分时间)

The main road in Bytecity is a straight line from south to north. Conveniently, there are coordinates measured in meters from the southernmost building in north direction.At some points on the road

2017-07-05 10:21:58 250

原创 Gym Class HDU - 5695

众所周知,度度熊喜欢各类体育活动。 今天,它终于当上了梦寐以求的体育课老师。第一次课上,它发现一个有趣的事情。在上课之前,所有同学要排成一列, 假设最开始每个人有一个唯一的ID,从1到NN,在排好队之后,每个同学会找出包括自己在内的前方所有同学的最小ID,作为自己评价这堂课的分数。麻烦的是,有一些同学不希望某个(些)同学排在他(她)前面,在满足这个前提的情况下,新晋体育课老师——度度熊,希

2017-07-05 09:00:18 228

转载 拓扑排序的原理及其实现

收藏了一下大神的教导:大神博客

2017-07-05 07:36:35 195

原创 Hard problem CodeForces - 706C (DP)

Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help.Vasiliy is given n strings consisting of lowercase English letters. He wants th

2017-07-04 22:46:00 273

原创 Triangle HDU - 5914 (斐波那契数列的应用1123)

Mr. Frog has n sticks, whose lengths are 1,2, 3⋯⋯n respectively. Wallice is a bad man, so he does not want Mr. Frog to form a triangle with three of the sticks here. He decides to steal some sticks!

2017-07-04 12:20:05 311

原创 Tempter of the Bone HDU - 1010 (奇偶性剪枝)

The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone

2017-07-04 12:12:31 296

原创 Cleaning Shifts POJ - 2376

Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to have one cow working on cleaning things up and has divided the day into T

2017-07-03 23:09:47 278

原创 A == B ? HDU - 2054

Give you two numbers A and B, if A is equal to B, you should print "YES", or print "NO".Inputeach test case contains two numbers A and B. Outputfor each case, if A is equal to B, you should pr

2017-07-03 18:14:02 206

转载 钱币兑换问题 HDU - 1284

Problem Description在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法。请你编程序计算出共有多少种兑法。Input每行只有一个正整数N,N小于32768。Output对应每个输入,输出兑换方法数。Sample Input293412553Sampl

2017-07-03 16:08:40 487

原创 Coach CodeForces - 300B

A programming coach has n students to teach. We know that n is divisible by 3. Let's assume that all students are numbered from 1 to n, inclusive.Before the university programming championship the

2017-07-02 19:54:02 449

空空如也

空空如也

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

TA关注的人

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