10192 最长公共子序列
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&
Itemid=8&page=show_problem&category=114&problem=1133&mosmsg=
Submission...
分类:
其他好文 时间:
2014-05-23 22:30:07
阅读次数:
528
题目大意:
输入一个文章,[ 就是把光标放到最前面 ] 把光标放到最后面。
输出最后得到的文章。
思路分析:
用deque 模拟。
#include
#include
#include
#include
#define maxn 111111
using namespace std;
char str[maxn];
deque Q;
deque::itera...
分类:
其他好文 时间:
2014-05-23 08:12:11
阅读次数:
335
题目大意:
超时进行促销,把账单放入一个箱子里
每次拿取数额最大的和最小的,给出 最大-最小 的钱。
问n天总共要给出多少钱。
思路分析:
multiset 上直接进行模拟
注意要使用long long
而且multiset的删除要用 迭代器。
#include
#include
#include
#include
#include
#define m...
分类:
其他好文 时间:
2014-05-23 08:11:38
阅读次数:
224
uva 548 Tree
题目大意:
给定一个二叉树的中序和后序遍历,求二叉树到每个叶节点的路径和最小的那个叶节点的值。
解题思路:
先建树,后dfs,建树也就是后序的最后一个就是二叉树的当前节点的值,再在中序中找到这个值,那么左边就是左子树,右边就是又子树,再从后序中找出相应的左右子树的后序,然后划分为子问题递归求解。...
分类:
其他好文 时间:
2014-05-23 08:10:59
阅读次数:
255
【题目】
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...
分类:
其他好文 时间:
2014-05-22 13:09:50
阅读次数:
247
Description
You are given a string consisting of parentheses () and []. A string of this type is said to be correct:
(a)if it is the empty string(b)if A and B are correct, AB is correct,(c)...
分类:
其他好文 时间:
2014-05-22 09:53:27
阅读次数:
295
UVA 10237 - Bishops
题目链接
题意:问一个n * n棋盘能放k个主教(攻击斜线)的方案数。
思路:递推,首先考虑一个问题,在一个n?n棋盘上,放k个车的方案数。
那么设dp[i][j]为i行用了j个车的方案数,由于每行只能放一个车,那么考虑i行放不放车,如果放车,那么能放的位置有n?(j?1)个位置,为dp[i?1][j?1]?(n?(j?1))。
如果不放那...
分类:
其他好文 时间:
2014-05-22 07:57:05
阅读次数:
148
题目链接:11375 - Matches
题目大意:给出n根火柴,问说能组成多少种数字,要求说0不能打头。
解题思路:d[i]表示i根火柴能够组成的数量,d[i+c[j]] = d[i+c[j]] + d[i];
最后dp[i]表示小于等于i根火柴能组成的数量,dp[i]=∑jidp[j].
高精度。
#include
#include
#include
using na...
分类:
其他好文 时间:
2014-05-18 10:21:35
阅读次数:
286
本题大概题意:
给出一个数组DNA,包含10个数值,如:DNA[10] = {0,1,2,3,,1,2,3,0,1,2}所有数值应该不大于3.
给出一行40个字符的字符串: 空格代表0, '.'代表1,'x'代表2,'W'代表3。 相邻三个数值(或两个数值)相加得到的数作为DNA的下标,然后取DNA数组改下标的数值为新的值。产生新的字符串。
好难说清楚,看原文吧,的确是很难理解的题目:
h...
分类:
其他好文 时间:
2014-05-18 03:14:55
阅读次数:
287
C - The Dole Queue
Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu
Submit Status
Description
The Dole Queue
In a serious attempt to down...
分类:
其他好文 时间:
2014-05-18 03:10:48
阅读次数:
326