自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

岁月蒙尘

一步一步走。

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

原创 JuQueen

题目来源:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=134851 输入:10 10 5state 0groupchange 2 9 7state 9groupchange 0 2 10change 0 -5输出:0773-3题意: 输入:n,top,Q

2015-05-22 09:05:06 526

原创 KMP

求子串#include#include#includeusing namespace std;int main(){    char a[1020], b[1020];    int i, j, next[1020], n, m;    while(scanf("%s",a+1)!= EOF&&a[1]!='#')    {        scanf("

2015-05-22 11:07:10 537 1

原创 最小的数

题目描述给你一个n位数,每次操作可以选该数任意的相邻两位进行交换,如果最多可以操作k次,那么最终可以得到的最小的数是什么(n位且不能含前导零)?输入有多组测试数据,第一行为数据个数T(T输出最终能得到的最小的数。样例输入2321654987 1321654987 2样例输出231654987132654987

2015-05-22 09:52:18 781

转载 括号匹配

题目描述有一串括号(只包含"(", ")", "[", "]", "{", "}"), 保证这一括号串是匹配的, 长度小于100000, 有m个询问, 每个询问为一个整数x;对于每一个询问, 要求输出一行四个整数y, a, b, c; 表示第x个括号是跟第y个配对的, x和y之间有a对小括号, b对中括号, c对大括号。输入约200个样例, 每个样例第一行为一个只包含括号的

2015-05-22 09:38:11 505

原创 人生成就

题目描述人生就像一个n*n的矩阵,矩阵每个元素都跟上下左右四个方向的元素联通,起始在左上角,终止在右下角,从起点开始,每次一个向右或向下移动一格。每个元素上面都有一个人生成就值,表示你如果经历这个元素时候能增加的人生成就。初始时候你的人生成就值为0,你当然想到达终点时候能获得最大的人生成就。那么问题来了:(你一定会以为我会要你求出到达终点时的最大人生成就值,但是你错了),问题就是,

2015-05-22 09:36:19 905

转载 Count the Colors(两种)

DescriptionPainting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segments of different colors you can se

2015-05-22 08:57:40 564

原创 Bit String Reordering

题目来源:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=139521输入:6 31 0 0 1 0 11 3 2输出:1题意:输入:n m (1第二行:n个数(只含1和0)第三行:m个数问用n个数1与0要移动多少次(相邻才能移动),利用1与0间隔个数才能表示出m个数

2015-05-22 08:28:55 1341

原创 Flipping Parentheses

题目来源:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=138130输入:6 3((()))431输出:221题意:输入n,q (2第二行再输入长度为n(下标从1开始)的字符串,只含‘(’和‘)’,且是匹配好的。再输入q个下标查询。问改变输入下标位置的字符,如‘

2015-05-22 08:02:13 879

原创 Friend

DescriptionOn an alien planet, every extraterrestrial is born with a number. If the sum of two numbers is a prime number, then two extraterrestrials can be friends. But every extraterrestrial ca

2015-05-22 07:47:20 602

原创 Convert QWERTY to Dvorak

Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY Keyboard with a broken Caps Lock key, so Edward never presses the broken Caps Lock key. Luckily, all the othe

2015-04-26 10:58:36 758

原创 May Day Holiday

As a university advocating self-learning and work-rest balance, Marjar University has so many days of rest, including holidays and weekends. Each weekend, which consists of Saturday and Sunday, is a

2015-04-26 10:49:51 932

原创 Min Number

Now you are given one non-negative integer n in 10-base notation, it will only contain digits ('0'-'9'). You are allowed to choose 2 integers i and j, such that: i!=j, 1≤i<j≤|n|, here |n| means the le

2015-04-01 21:08:01 389

原创 Hangover

题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=10018题意:输入一个 M    当1/2 + 1/3 + 1/4 + ... + 1/(n + 1)>=M时,输出n// 打表#includedouble a[500];void fun(){ int i; for(i=1;i<

2015-04-01 21:02:39 450

原创 Air Raid

Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from an intersection and walking through town's streets you can

2015-04-01 21:00:24 478

原创 防守阵地 II

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

2015-04-01 20:57:34 462

原创 Just a Hook

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length. No

2015-04-01 20:54:30 385

原创 Machine Schedule

As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduling problems differ widely in the nature of the constraints that

2015-04-01 20:52:07 469

原创 等式数量

Description集合是基本的数学概念,它是集合论的研究对象。关于集合论最简单的说法,是在最原始的集合论《朴素集合论》中的定义:集合就是“一堆东西”。集合里的“东西”,叫作元素。若x是集合A中的元素,记作 x∈A。集合中的元素是互不相同的。 表示相等关系的式子叫做等式。 给你一个包含有N个整数的集合,如果从集合中找到三个不同的整数a,b,c使得a+b=c,那么我们说这个集合

2015-04-01 20:39:45 671

原创 Counterfeit Dollar

题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=16424题意 : 有12个硬币 有一个是假的 比其他的或轻或重     分别标记为A到L然后输入cas 有个cas组数据每组输入3行 每行3个字符串 第一个表示当时天平上左边有哪几个字符  第二个是右边 2边个数一样 但是不一定有几个    之后第三个

2015-04-01 20:30:59 564

原创 统计难题

Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).  Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,

2015-04-01 20:29:30 416

转载 Flow Problem

DescriptionNetwork flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted directed graph. InputThe first line

2015-04-01 20:15:28 498

原创 最短的名

Description在一个奇怪的村子中,很多人的名字都很长,比如aaaaa, bbb and abababab。名字这么长,叫全名显然起来很不方便。所以村民之间一般只叫名字的前缀。比如叫'aaaaa'的时候可以只叫'aaa',因为没有第二个人名字的前三个字母是'aaa'。不过你不能叫'a',因为有两个人的名字都以'a'开头。村里的人都很聪明,他们总是用最短的称呼叫

2015-04-01 20:05:34 453

原创 Uva 除法

输入正整数n,按从小到大的顺序输出所有形如abcde/fghij=n的表达式,其中a~j恰好为数字0-9的一个排列(可以有前导0,)2样例输入:63样例输出:79546 / 01283 = 6294736 / 01528 = 62思路:枚举fghij,算出abcde,判断每一个都不相等//用sprintf#include#include#include#inc

2015-03-12 21:47:08 765

原创 最大乘积 Uva 11059

输入n个元素组成的序列S,你需要找出一个乘积最大的连续子序列。如果这个最大的乘积不是正数,应输出0(表示 无解)。1样例输入:32 4 -352 5 -1 2 -1样例输出:820思路: 枚举第一个和最后一个#include#includeusing namespace std;int main(){ int n,m,i,j; i

2015-03-12 21:42:08 664

原创 排列2

Problem DescriptionRay又对数字的列产生了兴趣:现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。 Input每组数据占一行,代表四张卡片上的数字(0 Output对每组卡片按从小到大的顺序输出所有能由这四张卡片组成的4位数,千位数字相同的在同一行,同一行中每个四位

2015-03-12 21:33:43 727

原创 大菲波数

Problem DescriptionFibonacci数列,定义如下:f(1)=f(2)=1f(n)=f(n-1)+f(n-2) n>=3。计算第n项Fibonacci数值。 Input输入第一行为一个整数N,接下来N行为整数Pi(1 Output输出为N行,每行为对应的f(Pi)。 Sample I

2015-03-12 21:28:15 700

原创 Play on Words

Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very impo

2015-03-09 19:29:56 513

原创 Easy Task

You are given n integers. Your task is very easy. You should find the maximum integer a and the minimum integer b among these n integers. And then you should replace both a and bwith a-b. Your task

2015-02-08 13:59:58 668

原创 Bomb

BombDescriptionThe counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. I

2014-12-30 21:06:20 774

原创 敌兵布阵

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

2014-12-30 20:21:45 539

原创 Ping pong

Ping pongDescriptionN(3N20000) ping pong players live along a west-east street(consider the street as a line segment). Each player has a unique skill rank. To improve their skill

2014-12-24 20:36:11 552

原创 Unique Snowflakes

Unique SnowflakesDescriptionProblem A: Unique SnowflakesEmily the entrepreneur has a cool business idea: packaging and selling snowflakes. She has devised a machine that captures

2014-12-16 21:26:11 971

原创 Java Beans

Java BeansDescriptionThere are N little kids sitting in a circle, each of them are carrying some java beans in their hand. Their teacher want to select M kids who seated in M consecuti

2014-12-14 20:46:44 635

原创 Star

StarDescriptionOverpower often go to the playground with classmates. They play and chat on the playground. One day, there are a lot of stars in the sky. Suddenly, one of Overpower’s cl

2014-12-14 20:38:25 536

原创 Min Number

Min NumberDescriptionNow you are given one non-negative integer n in 10-base notation, it will only contain digits ('0'-'9'). You are allowed to choose 2 integers i and j, such that: i

2014-12-14 20:33:38 531

原创 Floor problem

B - Floor problemDescriptionIn this problem, we have f(n,x)=Floor[n/x]. Here Floor[x] is the biggest integer such that no larger than x. For example, Floor[1.1]=Floor[1.9]=1, Floor[2.0

2014-12-14 20:29:59 541

原创 The Falling Leaves

Each year, fall in the North Central region is accompanied by the brilliant colors of the leaves on the trees, followed quickly by the falling leaves accumulating under the trees. If the same thing ha

2014-12-01 17:43:42 478

原创 Break Standard Weight

The balance was the first mass measuring instrument invented. In its traditional form, it consists of a pivoted horizontal lever of equal length arms, called the beam, with a weighing pan, also called

2014-12-01 17:37:48 517

原创 X-Plosives

A secret service developed a new kind of explosive that attain its volatile property only when a speci cassociation of products occurs. Each product is a mix of two different simple compounds, to wh

2014-11-23 20:37:40 535

原创 Fabled Rooks

Problem F: Fabled RooksWe would like to place n rooks, 1 ≤  n ≤ 5000, on a n×n board subject to the following restrictionsThe i-th rook can only be placed within the rectangle given by i

2014-11-23 20:23:07 463

空空如也

空空如也

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

TA关注的人

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