LA 2995 Image Is Everything
来源:互联网 发布:网络推广月度工作计划 编辑:程序博客网 时间:2024/05/24 05:51
题目
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=26450
题解
其实这道题只要看了题解就好简单的样子,注意学习他的化简代码的神奇能力和分析问题化简为繁的神奇能力
代码
#include<queue>#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#define rep(i,x,y) for(int i=x;i<=y;i++)using namespace std;const int maxn=10+5;const int maxm=10;char mx[maxm][maxn][maxn],cell[maxn][maxn][maxn];int n;inline char input(){ char ch=getchar(); while(ch==' '||ch=='\n') ch=getchar(); return ch;}inline void get(int k,int i,int j,int dep,int &x,int &y,int &z){ if(k==1) {x=i; y=j; z=dep; return ;} if(k==2) {x=i; y=dep; z=n+1-j; return ;} if(k==3) {x=i; y=n+1-j; z=n+1-dep;return ;} if(k==4) {x=i; y=n+1-dep;z=j; return ;} if(k==5) {x=dep;y=j; z=n+1-i; return ;} x=n+1-dep;y=j;z=i;}int x,y,z;inline void solve(){ rep(X,1,n) rep(Y,1,n) rep(Z,1,n) cell[X][Y][Z]='#'; rep(i,1,n) rep(k,1,6) rep(j,1,n) { mx[k][i][j]=input(); if(mx[k][i][j]=='.') rep(dep,1,n) { get(k,i,j,dep,x,y,z); cell[x][y][z]='.'; } } int done=1; while(done) { done=0; rep(k,1,6) rep(i,1,n) rep(j,1,n) if(mx[k][i][j]!='.') rep(dep,1,n) { get(k,i,j,dep,x,y,z); char &Cell=cell[x][y][z]; if(Cell=='.') continue; if(Cell=='#') { Cell=mx[k][i][j];break; } if(Cell==mx[k][i][j]) break; Cell='.'; done=1; } } int ans=0; rep(X,1,n) rep(Y,1,n) rep(Z,1,n) if(cell[X][Y][Z]!='.') ans++; printf("Maximum weight: %d gram(s)\n",ans); return ;}inline void debug(){ int k,i,j,dep; scanf("%d%d%d%d%d",&n,&k,&i,&j,&dep); get(k,i,j,dep,x,y,z); printf("x=%d y=%d z=%d",x,y,z); return ;}int main(){ while(scanf("%d",&n)==1&&n) solve();// debug(); return 0;}
0 0
- la 2995 Image is everything
- LA 2995 Image Is Everything
- LA 2995 Image Is Everything
- LA 2995 Image Is Everything *
- LA 2995 & ZOJ2714 Image is Everything
- (LA 2995)立方体成像(Image Is Everything )
- UVALive 2995 Image Is Everything
- UVaLive-2995 Image Is Everything
- UVALive 2995 Image Is Everything 策略问题
- UVaLive 2995 Image Is Everything 立方体成像
- UVaLive 2995 Image Is Everything (贪心+模拟)
- UVALive 2995Image Is Everything 策略问题
- Image Is Everything
- Image Is Everything
- LA2995- Image Is Everything
- uva1030 Image Is Everything
- 1030 - Image Is Everything
- Image Is Everything UVALive
- python中几种不同类型的参数的区分及其定义时的顺序
- 【RT-Thread学习笔记 2】RT-Thread的线程(任务)处理
- Redis安装+主从配置 过程中 的几个小 Tips
- 利用Digester实现xml和bean之间的转换(二)
- rsyslog研究
- LA 2995 Image Is Everything
- 给DotSpatial实现中距离/长度测量图层
- OData Edm.Geography和Edm.Geometry基本类型
- JQuery定时器
- 【RT-Thread学习笔记 3】线程优先级抢占实验
- 框架
- java中静态代码块的用法 static用法详解
- 数据库日期毫秒转换
- as3 组件通信