题目链接:uva 1508 - Equipment
题目大意:给出n个5元组,要求从中选取k个,要求5个位置上的数的最大值的和尽量大。
解题思路:对于每个元组,有25?1种选取方法,那么处理出这些选取方法中的最大值即可,然后暴力枚举。
#include
#include
#include
using namespace std;
const int maxn = 10005;...
分类:
其他好文 时间:
2014-07-22 00:17:35
阅读次数:
192
uva 269 - Counting
Patterns
题目大意:给出n和k,要求找出满足的序列,要求为n元组,由-k到k组成,并且和为0。求出所有满足的元组个数,并且对于左移,右移,水平翻转,每个元素取相反数相同的视为一种,用字典序最大的表示,输出按照字典序最小的输出。
解题思路:因为表示的时候按照字典序最大的表示,一开始枚举开头的位置,那么在后面的数的绝对值就不会大于该数。最后...
分类:
其他好文 时间:
2014-07-22 00:16:37
阅读次数:
246
题目链接:uva 1509 - Leet
题目大意:给出k,表示一个字符可以对应k给字符编码,给出字符串1,问时候有符合的编码可以生成字符串2.
解题思路:暴力枚举,对于每个碰到的字符记录对应的编码。
#include
#include
#include
using namespace std;
const int maxn = 105;
const int maxc = ...
分类:
其他好文 时间:
2014-07-22 00:15:33
阅读次数:
216
Description
Problem H
Halum
Time Limit : 3 seconds
You are given a directed graph G(V,E) with a set of vertices and edges. Each edge (i,j) that connects some ...
分类:
其他好文 时间:
2014-07-22 00:11:35
阅读次数:
225
Description
Problem H
Halum
Time Limit : 3 seconds
You are given a directed graph G(V,E) with a set of vertices and edges. Each edge (i,j) that connects some ...
分类:
其他好文 时间:
2014-07-22 00:08:34
阅读次数:
307
UVA 1560 - Extended Lights Out
题目链接
题意:给定一个矩阵,1代表开着灯,0代表关灯,没按一个开关,周围4个位置都会变化,问一个按的方法使得所有灯都变暗
思路:两种做法:
1、枚举递推
这个比较简单,就枚举第一行,然后递推过去,每次如果上一行是亮灯,则下一行开关必须按下去
2、高斯消元,
这个做法比较屌一些,每个位置对应上下左右中5个位...
分类:
其他好文 时间:
2014-07-21 23:30:00
阅读次数:
244
Description
During the Warring States Period of ancient China(476 BC to 221 BC), there were seven kingdoms in China -- they were Qi, Chu, Yan, Han, Zhao, Wei and Qin. Ying Zheng was the king of the...
分类:
其他好文 时间:
2014-07-21 23:27:49
阅读次数:
437
Distinct Subsequences
A subsequence of a given sequence is just the given sequence with some elements (possibly none) left out. Formally, given a sequence X = x1x2…xm,
another sequence Z = z1...
分类:
其他好文 时间:
2014-07-21 15:44:16
阅读次数:
244
思路就是用栈来模拟,一开始就是n个栈。每个栈里都是一个元素,然后按照指令移,在这个栈里pop()掉它,在另一个栈里push()进去。。
分四种情况来做移动,每种情况处理方式不一样。要注意如果是一堆移过去,因为还是要按照这个顺序,多以要先把这一堆放到另一个数组,再按顺序pushj进去。
模拟完输出即可。。...
分类:
其他好文 时间:
2014-07-21 15:11:15
阅读次数:
212