Puzzle,ACM/ICPC World Finals 1993,UVa227
来源:互联网 发布:淘宝店铺怎么批量改价 编辑:程序博客网 时间:2024/04/26 13:10
#include<iostream>#include<string>using namespace std;char word[5][6];int A(int &x,int& y){if(y==0){cout<<"This puzzle has no final configuration"<<endl;return 2;}else {swap(word[x][y],word[x][--y]);return 0;}}int B(int &x,int &y){if(y==4){cout<<"This puzzle has no final configuration"<<endl;return 2;}else {swap(word[x][y],word[x][++y]);return 0;}}int L(int &x,int &y){if(x==0){cout<<"This puzzle has no final configuration"<<endl;return 2;}else {swap(word[x][y],word[--x][y]);return 0;}}int R(int &x,int &y){if(x==4){cout<<"This puzzle has no final configuration"<<endl;return 2;}else {swap(word[x][y],word[++x][y]);return 0;}}int main(){for(;;){int count=1;int x,y;gets(word[0]);if(word[0][0]=='Z')break;for(int i=1;i<5;i++)gets(word[i]);for(int i=0;i<5;i++){for(int j=0;j<5;j++){if(word[i][j]==' '){x=i;y=j;}}}string str;cin>>str;int leng=str.length();int real=0;for(int i=0;i<leng;i++){switch(str[i]){case 'A':real=A(x,y);break;case 'B':real=B(x,y);break;case 'L':real=L(x,y);break;case 'R':real=R(x,y);break;default :real=1;}if(real)break;}if(!(real-1)){cout<<"Puzzle #"<<count<<":"<<endl;for(int i=0;i<5;i++){for(int j=0;j<4;j++)cout<<word[j][i]<<" ";cout<<word[5][i];cout<<endl;}count++;cout<<endl;}}}
0 0
- Puzzle, ACM/ICPC World Finals 1993, UVa227
- Puzzle,ACM/ICPC World Finals 1993,UVa227
- Puzzle,ACM/ICPC World Finals 1993, UVa227
- 谜题 (Puzzle, ACM/ICPC World Finals 1993, UVa227)
- 谜题(Puzzle, ACM/ICPC World Finals 1993, UVa227)(难死了!!)
- 3-5谜题(Puzzle, ACM/ICPC World Finals 1993, UVa227)
- UVa227 and acm/icpc world finals 1993 谜题
- ACM-ICPC World Finals 2017
- ACM-ICPC 2013 World Finals 简单题解
- ACM/ICPC World Finals 2013 D Factors
- ACM/ICPC World Finals 2010 D Castles
- Gym 101205 (ACM-ICPC World Finals 2012)
- Sqaures, ACM/ICPC World Finals 1990, UVa
- UVA 227 Puzzle 【ACM/ICPC World Final 1993】
- 习题7-2 黄金图形(Golygons, ACM/ICPC World Finals 1993, UVa225)
- 浙江大学获ACM-ICPC World Finals …
- 【ACM ICPC World Finals 2012】 Curvy Little Bottles (二分)
- Crossword Answers, ACM/ICPC World Finals 1994, UVa232
- 常用快递API及快递在线下单API分享
- Android 动画基础详解
- ie下透明度设置(与rgba相对应)
- iOS端打开文档示例代码
- 通过程序设置鼠标的样式
- Puzzle,ACM/ICPC World Finals 1993,UVa227
- 36.微信开发获取openId
- guava之Maps常用示例及newHashMapWithExpectedSize()详解
- JavaScript监听键盘按下事件,获取按键的Unicode 编码符
- 关于RxJava最友好的文章
- 用bind方法保持this上下文
- Android布局之baselineAligned属性
- Vmvare Workstation 12 Pro如何安装Linux系统
- Ubuntu下linux安装cmake