ZOJ 3429 Cube Simulation 解题报告
来源:互联网 发布:广电 知乎 编辑:程序博客网 时间:2024/06/05 11:24
题目
题意:
三维空间上定义了一些操作,就不翻译了……求每个询问操作的结果
题解:
本来以为很难,后来发现三个坐标是独立的,所以做到当前操作时,可以维护一个映射关系,原本的xi现在应该在xj,就可以直接求了。
难怪过的人最多
//Time:110ms//Memory:204KB//Length:1354B#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>#include <queue>using namespace std;#define MAXN 1010int to[3][MAXN],nto[3][MAXN];char str[20];int main(){ //freopen("/home/moor/Code/input","r",stdin); int xy[3]; while (scanf("%s",str)!=-1) { if(str[2]=='L') { for(int i=0;i<3;++i) scanf("%d",&xy[i]); for(int i=0;i<3;++i) for(int j=0;j<=xy[i];++j) to[i][j]=j,nto[i][j]=j; printf("START\n"); } if(str[2]=='A') { int a,b,af,bf,w=str[4]-'1'; scanf("%d%d",&a,&b); af=nto[w][a],bf=nto[w][b]; swap(nto[w][a],nto[w][b]); swap(to[w][af],to[w][bf]); } if(str[2]=='N') { long long x; int tx,ty,tz,tmp=xy[1]*xy[2]; scanf("%lld",&x); if(x>xy[0]*xy[1]*xy[2]) continue; --x; tx=x/tmp,ty=x/xy[2]%xy[1],tz=x%xy[2]; tx=to[0][tx],ty=to[1][ty],tz=to[2][tz]; printf("%d %d %d\n",tx,ty,tz); } if(str[2]=='E') { int tx,ty,tz; scanf("%d%d%d",&tx,&ty,&tz); tx=nto[0][tx],ty=nto[1][ty],tz=nto[2][tz]; printf("%d\n",xy[1]*xy[2]*tx+xy[2]*ty+tz+1); } } return 0;}
- ZOJ 3429 Cube Simulation 解题报告
- ZOJ 3429 Cube Simulation
- zoj-3429-Cube Simulation
- ZOJ Problem Set - 3429 Cube Simulation
- zoj 4113 Cube Simulation ( ZOJ Monthly, November 2010 )
- Binary Simulation 解题报告--线段树
- [Leetcode] 573. Squirrel Simulation 解题报告
- zoj 1005 解题报告
- zoj 1027解题报告
- zoj 1108解题报告
- [解题报告]ZOJ 1001
- zoj 3212 解题报告
- zoj 1312解题报告
- ZOJ 1115 解题报告
- zoj 1002解题报告
- ZOJ 1610 解题报告
- ZOJ-1796解题报告
- ZOJ 3201解题报告
- ASIHTTPRequest-数据压缩
- 这些天都一版一版的来的。
- linux用户管理命令
- CMFCToolTipInfo选件类
- 单片机驱动段式液晶屏
- ZOJ 3429 Cube Simulation 解题报告
- 利用Hog特征和SVM分类器进行行人检测
- vim syntastic 安装
- Maven 实战 00 安装
- ASIHTTPRequest-断点续传(下载)
- js的类型检查
- Win7下安装apache服务器
- Maven 实战 01 使用入门
- 读取Movies.plist文件并显示到table View中