魔方

思路:

  模拟;

代码:

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; struct MFType {
int ai[][];
};
struct MFType ci[]; int len; char done[],ch[]; /* 1.front
2.back
3.left
4.right
5.top
6.under */ void OperationType_right_turning90()
{
MFType *now=&ci[],tmp=ci[];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now=&ci[],tmp=ci[];
MFType *pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&tmp;
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
} void OperationType_right_turningback90()
{
MFType *now=&ci[],tmp=ci[];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now=&ci[],tmp=ci[];
MFType *pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&tmp;
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
} void OperationType_top_turning90()
{
MFType *now=&ci[],tmp=ci[];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now=&ci[],tmp=ci[];
MFType *pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&tmp;
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
} void OperationType_top_turningback90()
{
MFType *now=&ci[],tmp=ci[];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now->ai[][]=tmp.ai[][];
now=&ci[],tmp=ci[];
MFType *pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&ci[];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now=&ci[],pos=&tmp;
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
now->ai[][]=pos->ai[][];
} void debug()
{
printf("\n");
for(int i=;i<=;i++)
{
printf("%d\n",i);
for(int j=;j<=;j++)
{
for(int v=;v<=;v++) printf("%d",ci[i].ai[j][v]);
printf("\n");
}
printf("\n");
}
printf("\n");
} int main()
{
freopen("cube.in","r",stdin);
freopen("cube.out","w",stdout);
scanf("%s",done),len=strlen(done);
for(int i=;i<=;i++)
{
for(int j=;j<=;j++)
{
scanf("%s",ch);
for(int v=;v<=;v++) ci[i].ai[j][v]=ch[v-]-'';
}
}
// debug();
for(int i=;i<len;i++)
{
if(done[i]=='') OperationType_right_turning90();
else if(done[i]=='') OperationType_right_turningback90();
else if(done[i]=='') OperationType_top_turning90();
else if(done[i]=='') OperationType_top_turningback90();
// debug();
}
for(int i=;i<=;i++)
{
for(int j=;j<=;j++)
{
for(int v=;v<=;v++) printf("%d",ci[i].ai[j][v]);
printf("\n");
}
}
return ;
}

AC日记——魔方 洛谷 P2007的更多相关文章

  1. AC日记——最大数 洛谷 P1198 [JSOI2008]

    题目描述 现在请求你维护一个数列,要求提供以下两种操作: 1. 查询操作. 语法:Q L 功能:查询当前数列中末尾L个数中的最大的数,并输出这个数的值. 限制:L不超过当前数列的长度. 2. 插入操作 ...

  2. AC日记——中位数 洛谷 P1168

    题目描述 给出一个长度为N的非负整数序列A[i],对于所有1 ≤ k ≤ (N + 1) / 2,输出A[1], A[2], …, A[2k - 1]的中位数.[color=red]即[/color] ...

  3. AC日记——传染病控制 洛谷 P1041

    传染病控制 思路: 题目想问的是: 有一棵树: 对于除1外每个深度可以剪掉一棵子树: 问最后剩下多少节点: 题目意思一简单,这个题立马就变水了: 搜索就能ac: 数据有为链的情况,按深度为层次搜索的话 ...

  4. AC日记——忠诚 洛谷 P1816

    题目描述 老管家是一个聪明能干的人.他为财主工作了整整10年,财主为了让自已账目更加清楚.要求管家每天记k次账,由于管家聪明能干,因而管家总是让财主十分满意.但是由于一些人的挑拨,财主还是对管家产生了 ...

  5. AC日记——独木桥 洛谷 p1007

    题目背景 战争已经进入到紧要时间.你是运输小队长,正在率领运输部队向前线运送物资.运输任务像做题一样的无聊.你希望找些刺激,于是命令你的士兵们到前方的一座独木桥上欣赏风景,而你留在桥下欣赏士兵们.士兵 ...

  6. AC日记——潜伏者 洛谷 P1071 (模拟)

    题目描述 R 国和 S 国正陷入战火之中,双方都互派间谍,潜入对方内部,伺机行动.历尽艰险后,潜伏于 S 国的 R 国间谍小 C 终于摸清了 S 国军用密码的编码规则: 1. S 国军方内部欲发送的原 ...

  7. AC日记——机器翻译 洛谷 P1540

    题目背景 小晨的电脑上安装了一个机器翻译软件,他经常用这个软件来翻译英语文章. 题目描述 这个翻译软件的原理很简单,它只是从头到尾,依次将每个英文单词用对应的中文含义来替换.对于每个英文单词,软件会先 ...

  8. AC日记——统计和 洛谷 P2068

    统计和 思路: 水题: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 100005 int n,m,tree ...

  9. AC日记——送花 洛谷 P2073

    送花 思路: 线段树: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 100005 struct TreeN ...

随机推荐

  1. 【转】cocos2dx 3.x 集成protobuf

    http://www.cnblogs.com/chevin/p/6001872.html vs2013+cocos2dx 3.13.1 这篇博文是集成Lua版本的protobuf,集成C++版本的过程 ...

  2. P2874 [USACO07FEB]新牛棚Building A New Barn

    题目描述 After scrimping and saving for years, Farmer John has decided to build a new barn. He wants the ...

  3. something about Parameter Estimation (参数估计)

    点估计 Point Estimation 最大似然估计(Maximum Likelihood Estimate —— MLE):视θ为固定的参数,假设存在一个最佳的参数(或参数的真实值是存在的),目的 ...

  4. 【转】IBatis.Net项目数据库SqlServer迁移至Oracle

    转自:http://www.2cto.com/database/201312/265514.html 最近完成了一个(IBatis.Net+MVC)项目的数据库+代码迁移工作,可把我折腾得~~~ IB ...

  5. Treap 模板

    感觉平衡树也没有以前想的那么玄乎,(其实set超好用的),非旋式Treap挺好理解,和可并堆,二叉搜索树有很大联系 推荐博客:http://memphis.is-programmer.com/post ...

  6. 如何最快地实现 ALTER TABLE

    如果您不了解ALTER TABLE的语法,可以先参考: http://dev.mysql.com/doc/refman/5.1/en/alter-table.html 使用ALTER TABLE 可以 ...

  7. HDU 多校对抗赛 J Time Zone

    Time Zone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  8. grub ubuntu启动

    set root=(hd0,gpt10) 现在变为 gpt9 了 安装固态后.变成了 (hd1,gpt11) set prefix=(hd0,gpt10)/boot/grub insmod norma ...

  9. Join EC2 into AD with SSM and remote powershell in AWS

    1.Create joinad.ps1 $username = "ad-domain\admin" $Password = "password" $pwd = ...

  10. 获取html元素内容

    html: <!DOCTYPE ><html> <head> <meta http-equiv="Content-Type" conten ...