ZOJ2477 Magic Cube】的更多相关文章

题目: This is a very popular game for children. In this game, there's a cube, which consists of 3 * 3 * 3 small cubes. We can unwrap the cube, it will become like this:       w w w      w w w      w w wr r r g g g b b b o o or r r g g g b b b o o or r…
ZOJ 2477 Magic Cube(魔方) Time Limit: 2 Seconds      Memory Limit: 65536 KB This is a very popular game for children. In this game, there's a cube, which consists of 3 * 3 * 3 small cubes. We can unwrap the cube, it will become like this: 这是个有名的儿童游戏.游戏…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1477 用IDA*可能更好,但是既然时间宽裕数据简单,而且记录状态很麻烦,就直接暴力了 #include <cstdio> #include <cstring> #include <algorithm> #include <cctype> using namespace std; char maz[54]; char readchar(){…
搜索题, 每个状态能扩展出12种状态,最多进行5次旋转12^5 要用到iddfs,或者我看到网上其他人用的ida* 我也是参考了别人的代码,而且这个题vj上有点问题,我看数据看了半天,愣是没看明白第二个数据咋回事,后来才知道是vj显示的有问题 #include<iostream> #include<queue> #include<cstring> #include<vector> #include<cstdio> #include<cmat…
大意: 给定$N^3$立方体, 每个单位立方体权值为三个坐标异或, 每次沿坐标轴切一刀, 得分为两半内权值和的乘积, 求切成$n^3$块的最大得分. 可以发现得分与切法无关, 假设每个点权值为$a_i$, 就有$ans=\frac{(\sum a_i)^2-\sum a_i^2}{2}$. 从而转化为求$f_x=\sum\limits_{i=0}^{N-1}\sum\limits_{j=0}^{N-1}\sum\limits_{k=0}^{N-1}[(i\oplus j\oplus k)=x]$…
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2606 Rubik’s cube Time Limit: 2000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述     Flabby is addicted to Rubik’s cube. He has many kinds of Rubik’s cube and plays them well. He can…
Magic SquaresIOI'96 Following the success of the magic cube, Mr. Rubik invented its planar version, called magic squares. This is a sheet composed of 8 equal-sized squares: 1 2 3 4 8 7 6 5 In this task we consider the version where each square has a…
关于魔方 魔方英文名字叫做Rubik's Cube,是由匈牙利建筑学教授和雕塑家Ernő Rubik于1974年发明,最初叫做Magic Cube(这大概也是中文名字的来历吧),1980年Ideal Toys公司开始销售此玩具,并将名字改为Rubik's Cube. 魔方在80年代最为风靡,至今未衰.截至2009年1月,魔方在全世界已经售出了3亿五千多万个.最常见的魔方是三阶魔方,由27个小方块构成,共三层,每层9个小方块.我的Demo实现的就是三阶魔方.其他的魔方种类有二阶,四阶及更高阶,也有…
发信人: fennec (fennec), 信区: Algorithm 标 题: acm 总结 by fennec 发信站: 吉林大学牡丹园站 (Wed Dec 8 16:27:55 2004) ACM总结(fennec) 其实在北京比赛完的时候,我就想写了,不过还是早了点,直到上海比赛结束,大家的心中都不是太好受.郭老师有句话:你们这样做也是对的,不成功就成仁.让我的心也能安慰了不少. 我是从大一下学期开始接触ACM的,那时候我们学校才刚刚起步,siyee,wjiang师兄可以说是我的领路人了…
注意输入的处理,旋转操作打表.递增枚举可能步数,作为限制方便找到最短路. AC代码:90ms #include<cstdio> #include<cstring> char magic[60]; int cube[6][9] = { {4,0,1,2,3,5,6,7,8},{22,9,10,11,21,23,33,34,35},{25,12,13,14,24,26,36,37,38}, {28,15,16,17,27,29,39,40,41},{31,18,19,20,30,32,…