AC日记——魔方 洛谷 P2007
思路:
模拟;
代码:
#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的更多相关文章
- AC日记——最大数 洛谷 P1198 [JSOI2008]
题目描述 现在请求你维护一个数列,要求提供以下两种操作: 1. 查询操作. 语法:Q L 功能:查询当前数列中末尾L个数中的最大的数,并输出这个数的值. 限制:L不超过当前数列的长度. 2. 插入操作 ...
- AC日记——中位数 洛谷 P1168
题目描述 给出一个长度为N的非负整数序列A[i],对于所有1 ≤ k ≤ (N + 1) / 2,输出A[1], A[2], …, A[2k - 1]的中位数.[color=red]即[/color] ...
- AC日记——传染病控制 洛谷 P1041
传染病控制 思路: 题目想问的是: 有一棵树: 对于除1外每个深度可以剪掉一棵子树: 问最后剩下多少节点: 题目意思一简单,这个题立马就变水了: 搜索就能ac: 数据有为链的情况,按深度为层次搜索的话 ...
- AC日记——忠诚 洛谷 P1816
题目描述 老管家是一个聪明能干的人.他为财主工作了整整10年,财主为了让自已账目更加清楚.要求管家每天记k次账,由于管家聪明能干,因而管家总是让财主十分满意.但是由于一些人的挑拨,财主还是对管家产生了 ...
- AC日记——独木桥 洛谷 p1007
题目背景 战争已经进入到紧要时间.你是运输小队长,正在率领运输部队向前线运送物资.运输任务像做题一样的无聊.你希望找些刺激,于是命令你的士兵们到前方的一座独木桥上欣赏风景,而你留在桥下欣赏士兵们.士兵 ...
- AC日记——潜伏者 洛谷 P1071 (模拟)
题目描述 R 国和 S 国正陷入战火之中,双方都互派间谍,潜入对方内部,伺机行动.历尽艰险后,潜伏于 S 国的 R 国间谍小 C 终于摸清了 S 国军用密码的编码规则: 1. S 国军方内部欲发送的原 ...
- AC日记——机器翻译 洛谷 P1540
题目背景 小晨的电脑上安装了一个机器翻译软件,他经常用这个软件来翻译英语文章. 题目描述 这个翻译软件的原理很简单,它只是从头到尾,依次将每个英文单词用对应的中文含义来替换.对于每个英文单词,软件会先 ...
- AC日记——统计和 洛谷 P2068
统计和 思路: 水题: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 100005 int n,m,tree ...
- AC日记——送花 洛谷 P2073
送花 思路: 线段树: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 100005 struct TreeN ...
随机推荐
- 用js通过url传参把数据从一个页面传到另一个页面
好长时间没写博客了,时值五一,外面到处人山人海,本宝宝还是好好呆在家学习吧.好了,言归正传.在没有后台支持的情况下,如何实现从一个页面像另一个页面来传递数据呢?应该很多人遇到过这个问题吧.那我就来说说 ...
- Google Play sign sha1 转 Facebook login 需要的 hashkey
:4E:::::3A:1F::A6:0F:F6:A1:C2::E5::::2E | xxd -r -p | openssl base64 输出 M05IhBlQOh9jpg/2ocIx5QE4VS4= ...
- request.getParameterMap() 获取表单提交的键值对 并且 也能获取动态表单的key
Map<String,String[]> map = request.getParameterMap();Set<String> keys = map.keySet(); 获取 ...
- BZOJ4318 OSU!(动态规划+概率期望)
设f[i][0/1]为考虑前i位,第i位为0/1时的期望得分(乘以是0/1的概率).暴力转移显然.前缀和优化即可. 但是这个前缀和精度无法承受,动不动就nan. 考虑增加一位的贡献.若之前后缀1的个数 ...
- AGC016C +/- Rectangle(构造)
题目大意:给定H,W,h,w四个数,求是否满足矩阵的全部数之和和正数,h行w列之和为负数 如果h和w恰好是H,W的约数,则肯定不存在 否则肯定存在 只需要把h,w内每个元素填的足够大,然后小矩形的最后 ...
- HDU 4776 Ants(Trie+优先队列)
Ants Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 327680/327680 K (Java/Others) Total S ...
- [Leetcode] Recover binary search tree 恢复二叉搜索树
Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing ...
- 停课day1
一早上只做了一个calculator 还是参照题解,好惭愧 f[1]=0; flag[1]=true; for (int i=2,N=num[n];i<p;i++) { fo ...
- 安卓和html的互相调用
1.写html和安卓布局 <Button android:id="@+id/btn" android:layout_width="wrap_content" ...
- nodejs npm insttall 带不带-g这个参数的区别
-g 中的g是global的意思所以带-g这个参数是全局安装,不带-g这个参数是本地安装. 在windows系统中全局安装的目录在:C:\Users\linsenq\AppData\Roaming\n ...