- 博客(15)
- 收藏
- 关注
原创 Codeforces Round #447 (Div. 2) B. Ralph And His Magic Field
Ralph has a magic field which is divided into n × m blocks. That is to say, there are n rows and m columns on the field. Ralph can put an integer in each block. However, the magic field doesn’t always
2017-11-20 12:10:19 148
原创 Codeforces Round #447 (Div. 2) C. Marco and GCD Sequence
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.When he woke up, he only remembered that the key was
2017-11-20 12:08:51 313
原创 Codeforces Round #446 (Div. 2) C.Pride
You have an array a with length n, you can perform operations. Each operation is like this: choose two adjacent elements from a, say x and y, and replace one of them with gcd(x, y), where gcd denotes t
2017-11-18 11:13:43 166
原创 Trees on the level UVA - 122
这道题设计到二叉树的层次遍历,直接开数组暴力去装肯定装不下,所以我们可以人为的按照输入顺序对每一个节点进行标号,然后用r[l]表示该节点的右子树,l[i]表示该节点的左子树,它们的值为-1时表示没有左子树或右子树.#include<bits/stdc++.h>#define ll long longusing namespace std;const int N=300;int r[N],l[
2017-11-17 18:59:08 201
原创 uva11988 Broken Keyboard (a.k.a. Beiju Text)
You’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problem with the keyboard is that sometimes the “home” key or the “end” key gets automatically pressed (interna
2017-11-13 21:49:08 211
原创 hdu 1789 How many ways(记忆化搜索)
这是一个简单的生存游戏,你控制一个机器人从一个棋盘的起始点(1,1)走到棋盘的终点(n,m)。游戏的规则描述如下:1.机器人一开始在棋盘的起始点并有起始点所标有的能量。2.机器人只能向右或者向下走,并且每走一步消耗一单位能量。3.机器人不能在原地停留。4.当机器人选择了一条可行路径后,当他走到这条路径的终点时,他将只有终点所标记的能量。如上图,机器人一开始在(1,1)点,并拥有4单位能量,
2017-11-09 20:55:48 141
原创 hdu 1505City Game
Bob is a strategy game programming specialist. In his new city building game the gaming environment is as follows: a city is built up by areas, in which there are streets, trees,factories and buildings
2017-11-09 20:23:57 259
原创 hdu 2870 Largest Submatrix
Now here is a matrix with letter 'a','b','c','w','x','y','z' and you can change 'w' to 'a' or 'b', change 'x' to 'b' or 'c', change 'y' to 'a' or 'c', and change 'z' to 'a', 'b' or 'c'. After you chang
2017-11-09 20:20:44 213
原创 hdu 2830 Matrix Swapping II
Given an N * M matrix with each entry equal to 0 or 1. We can find some rectangles in the matrix whose entries are all 1, and we define the maximum area of such rectangle as this matrix’s goodness.We c
2017-11-09 20:16:03 139
原创 hdu 1789Doing Homework again
Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after the
2017-11-09 20:10:05 167
原创 hdu1506 Largest Rectangle in a Histogram
Problem Description A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figur
2017-11-09 16:35:59 261
原创 HDU 1159.Common Subsequence
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1159题目大意:给出两个字符串,求两个字符串的最长公共字串。思路:慢慢重心开始有贪心转向动态规划了,这题就是简单的动态规划题。以题目的第一组测试数据为例。abcfbc abfcab。辅助空间变化示意图可以看出:F[i][j]=F[i-1][j-1]+1;(a[i]==b[j])F[i][j]=max(
2017-11-09 12:35:21 152
原创 hdu 5701
中位数是所有值从小到大排序后排在正中间的那个数,如果值有偶数个,通常取最中间的两个数值的平均数作为中位数。现在有n个数,保证n个数中无重复数字,求出每个数在多少个包含其的区间中是中位数。Input 多组测试数据第一行一个数n(n<8000)第二行n个数,0<每个数<=1e9,Output N个数,依次表示第i个数在多少包含其的区间中是中位数。 Sample Input51
2017-11-07 18:19:08 200
原创 CodeForces - 96B
Petya喜欢幸运数字。 大家都知道,正数整数是幸运的,如果它们的十进制表示不包含4和7以外的数字。例如,数字47,744,4是幸运的,5,17,46,7不是。 幸运数字超级幸运,如果它的十进制表示包含相等数量的数字4和7.例如,数字47,7744,474477是超级幸运,4,744,467不是。 有一天,Petya遇到了一个正整数n。 帮助他找出大于等于给定的数字的最小的超级幸运数字.Input
2017-11-07 18:08:42 363
原创 hdu 5884
首先将一下我的思路历程: 读题之后发现,有n-1个数,每次扩展k-1个数. 刚开始想的是直接用队列,但是发现合并之后的数字不一定是新序列里面最小的那一个,所以就考虑到了优先队列,但是这里有一个坑点,就是如果我们不能刚好把序列里面的这些数扩展完(即最后一次扩展并不是k-1个数),那么我们需要先进行一次扩展,使剩下的数在扩展时满足每一次都被扩展k-1个数的条件,这里很多博客并没有见讲很清楚,我看了下
2017-11-07 17:36:36 363
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人