码迷,mamicode.com
首页 >  
搜索关键字:uva 116    ( 8022个结果
UVA 12657 Boxes in a Line
双向链表注意:如果算法是最后处理翻转情况时,注意指令4翻转后1,2两个指令也要翻转处理; 指令3 中交换盒子要注意两个盒子相邻的情况 1 #include 2 #include 3 using namespace std; 4 5 int ri[100010],le[100010]; 6 ...
分类:其他好文   时间:2014-07-19 17:15:13    阅读次数:154
UVa 10318 Security Panel
题意:给你一个3*3的翻转模版,深色部分表示翻转,浅色部分不变。然后你可以在r*c的矩形里依照模版进行翻转,要求所有点亮所有块。输出最小的步骤。思路:有一点比较好想。每个块至多被翻转一次,翻两次的效果是一样的。这样可以搜索,大约2^25,会超时。考虑剪枝。对于每次翻转,只会影响与它临近的几个块,也就...
分类:其他好文   时间:2014-07-19 00:31:44    阅读次数:278
uva 1586 - Molar mass
在想更好的处理方法,现在却只能有这个糟烂的代码了……不好意思#include #include #include using namespace std; const int maxn=200; char s[maxn]; double ans[maxn]; int get_num(int pos,int len) { int temp; for(int i=pos;i<len...
分类:其他好文   时间:2014-07-18 18:07:51    阅读次数:220
UVa 11583 Partitioning by Palindromes
?? Description Problem H: Partitioning by Palindromes We say a sequence of characters is a palindrome if it is the same written forwards and backwards. For example, 'racecar' is a palindrome,...
分类:其他好文   时间:2014-07-18 15:13:10    阅读次数:266
10294 - Arif in Dhaka (First Love Part 2) (数论置换)
UVA 10294 - Arif in Dhaka (First Love Part 2) 题目链接 题意:给定n个珠子,t种颜色, 问能组成几个项链和手镯(手镯能翻转,项链不能) 思路:利用Burnside求解,推理出旋转的循环个数是gcd(i, n),翻转的分为奇偶情况考虑 代码: #include #include const int N = 30; in...
分类:其他好文   时间:2014-07-18 15:12:41    阅读次数:215
UVA 12103 - Leonardo's Notebook(数论置换群)
UVA 12103 - Leonardo's Notebook 题目链接 题意:给定一个字母置换B,求是否存在A使得A^2=B 思路:任意一个长为 L 的置换的k次幂,会把自己分裂成gcd(L,k) 分, 并且每一份的长度都为 L / gcd(l,k),因此平方对于奇数长度不变,偶数则会分裂成两份长度相同的循环,因此如果B中偶数长度的循环个数不为偶数必然不存在A了 代码: ...
分类:其他好文   时间:2014-07-18 15:12:10    阅读次数:300
UVA 11077 - Find the Permutations(递推)
UVA 11077 - Find the Permutations 题目链接 题意:给定n,k求出有多少个包含元素[1-n]的序列,交换k次能得到一个[1,2,3...n]的序列 思路:递推dp[i][j]表示i个元素需要j次,那么在新加一个元素的时候,添在最后面次数不变,其余位置都是次数+1,这是可以证明的,原序列中有几个循环,需要的次数就是所有循环长度-1的和,那么对于新加一...
分类:其他好文   时间:2014-07-18 15:10:12    阅读次数:230
UVA 1541 - To Bet or Not To Bet(概率递推)
UVA 1541 - To Bet or Not To Bet 题目链接 题意:这题题意真是神了- -,看半天,大概是玩一个游戏,开始在位置0,终点在位置m + 1,每次扔一个硬币,正面走一步,反面走两步,走到的步上有4种情况: 1、向前走n步 2、向后走n步 3、停止一回合 4、无影响 问能在t次机会内,走到终点m + 1(如果跃过也算走到了)的概率,大于0.5,等于0...
分类:其他好文   时间:2014-07-18 14:10:34    阅读次数:207
UVA - 12232 Exclusive-OR (并查集扩展偏离向量)
Description You are not given n non-negative integers X0, X1,..., Xn-1 less than 220, but they do exist, and their values never change. I'll gradually provide you some facts about them, and as...
分类:其他好文   时间:2014-07-18 13:35:47    阅读次数:458
UVA 10042 Smith Numbers(数论)
Smith Numbers Background While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University , noticed that the telephone number of his brother-in-law H. Smith had ...
分类:其他好文   时间:2014-07-18 13:28:06    阅读次数:234
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!