码迷,mamicode.com
首页 >  
搜索关键字:uva 10801    ( 8022个结果
uva----11729 Commando war (突击战争)
GCommando WarInput:Standard InputOutput:Standard Output“Waiting for orders we held in the wood, word from the front never cameBy evening the sound of ...
分类:其他好文   时间:2014-05-20 00:46:38    阅读次数:304
UVA 11270 Tiling Dominoes(插头DP)
题目链接:11270 - Tiling Dominoes 和POJ 2411一样的题目,试着用插头DP写了下 代码: #include #include #include using namespace std; int n, m, pre = 0, now = 1; long long dp[2][2222]; int main() { while (~scanf("%d%d",...
分类:其他好文   时间:2014-05-18 14:44:37    阅读次数:264
uva 10391 Compound Words (字符串-hash)
uva 10391 Compound Words (字符串-hash) 题目大意: 有一堆按照字典序排好的字符串,问你有多少字符串是由其它两个字符串组成。 解题思路: 如果用两个字符串拼接看拼接好的字符串是否在字典中,一定会超时。 我们可以逆向,由于字符串的长度不是很长,所以把一个字符串拆为两个字符串看这两个字符串是否都在字典中即可 解题代码一: 判断字符串是否在字典中,可以用STL set,也是轻松AC 解题代码二: 判断字符串是否在字典中,可以用hash,于是手写ha...
分类:其他好文   时间:2014-05-16 02:48:12    阅读次数:377
UVa 10047 - The Monocycle
题目:在一个n*m的迷宫中有一个轮子,轮子的每个72°的扇面被涂上一种不同的颜色。             轮子可以移动到上下左右四个方向的格子中,每次移动到相邻格子中,轮子转动72°。             每个单位时间轮子可以做两种运动:             1.移动到相邻格子;2.改变朝向,面向原来的左、右方(朝向改变90°),但不转动。             初始时轮子在'...
分类:其他好文   时间:2014-05-15 12:28:14    阅读次数:450
uva-----11292 The Dragon of Loowater
Problem C: The Dragon of LoowaterOnce upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem.The shores of Rellau Creek...
分类:其他好文   时间:2014-05-15 09:53:27    阅读次数:254
UVA之1121 - Subsequence
【题目】 A sequence of N positive integers (10 N , each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the subse...
分类:其他好文   时间:2014-05-15 07:58:17    阅读次数:329
uva 101 - The Blocks Problem
用 栈 stack 来模拟 题目意思:http://blog.csdn.net/mobius_strip/article/details/12765319 下面的代码有坑,输出格式需要调。 #include #include #include #include #include using namespace std; const int maxn=25+5; stacks[maxn]; i...
分类:其他好文   时间:2014-05-15 07:22:04    阅读次数:273
uva 11401 - Triangle Counting(数论)
题目链接:uva 11401 - Triangle Counting 题目大意:有多少种方法可以从1,2,3...n中选出3个不同的数组成三角形,给出n,求种数。 解题思路:加法原理,设最大边为x的三角形有c(x)个,那么另外两条边长分别为y和z,根据三角形的形式可以的y+z>x,所以z的范围即为x?yzx 根据这个不等式可以得到每个y值所对应的z值个数,为等差数列,所以 c(...
分类:其他好文   时间:2014-05-15 03:03:34    阅读次数:248
UVa 991 Safe Salutations 卡特兰数
题目来源:UVa 991 Safe Salutations 题意:圆上2*n个点均匀分布 两两相连 求不相交的方案数 思路:卡特兰数的应用 /* 最典型的四类应用:(实质上却都一样,无非是递归等式的应用,就看你能不能分解问题写出递归式了) 1.括号化问题。 矩阵链乘: P=a1×a2×a3×……×an,依据乘法结合律,不改变其顺序,只用括号表示成对的乘积,试问有几种括号化的方案?(h(n)...
分类:其他好文   时间:2014-05-14 20:52:44    阅读次数:370
uva 11806 - Cheerleaders(容斥原理)
题目链接:uva 11806 - Cheerleaders 题目大意:在一个m行n列的矩阵网里放k个石子,问有多少种画法?每个格子最多放一个石子,所有石子必须用完,并且在第一行、最后一行、第一列和最后一列都得有石子。 解题思路:容斥原理,我们可以先求说在m?n的矩阵上放k个石子的种数C(nmk),减掉四条边界不放的情况就是答案了。所以枚举16种状态,用二进制数表示说四条边中那些边是不放...
分类:其他好文   时间:2014-05-14 19:57:17    阅读次数:219
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!