poj2993
来源:互联网 发布:linux扫描工具 编辑:程序博客网 时间:2024/05/22 07:05
//poj2993 poj2996 的逆向题目 #include <iostream>#include <string>using namespace std;char c[17][33];bool first(int k){if(k == 1 || k == 5 || k == 9 || k == 13)return true;return false;}void init(int myRow, int myCol){for(int i = 0; i < myRow; i++){for(int j = 0; j < myCol; j++){if(i % 2 == 0){for(int k = 0; k < myCol; k++){if(k % 4 == 0)c[i][k] = '+';else c[i][k] = '-';}break;}else{if(first(i)) //白黑 {for(int k = 0; k < myCol; k++){if(k % 4 == 0)c[i][k] = '|';else{if(k % 8 < 4){c[i][k] = '.';}else{c[i][k] = ':';}}}break;}else //黑白 {for(int k = 0; k < myCol; k++){if(k % 4 == 0)c[i][k] = '|';else{if(k % 8 > 4){c[i][k] = '.';}else{c[i][k] = ':';}}}break;}}}}}bool role(char cc){if(cc == 'K' || cc == 'Q' || cc == 'R' || cc == 'B' || cc == 'N')return true;return false;}void deal(int myRow, int myCol){string b;getline(cin, b); //白 string a;getline(cin, a); //黑 int k = 0;while(b[k++] != 'K');int m = k - 1;while(m < b.length()){if(role(b[m])){int col = (b[m + 1] - 'a') * 4 + 2;int row = 15 - (int(b[m + 2] - '0') - 1 ) * 2; switch(b[m]){case 'K':c[row][col] = 'K';break;case 'Q':c[row][col] = 'Q'; break;case 'R':c[row][col] = 'R'; break;case 'B':c[row][col] = 'B'; break;case 'N':c[row][col] = 'N'; break;}m += 4;}else{int col = col = (b[m] - 'a') * 4 + 2;int row = 15 - (int(b[m + 1] - '0') - 1 ) * 2; c[row][col] = 'P';m += 3;}}//getline(cin, b);k = 0;while(a[k++] != 'K');m = k - 1;while(m < a.length()){if(role(a[m])){int col = (a[m + 1] - 'a') * 4 + 2;int row = 15 - (int(a[m + 2] - '0') - 1 ) * 2; switch(a[m]){case 'K':c[row][col] = 'k';break;case 'Q':c[row][col] = 'q'; break;case 'R':c[row][col] = 'r'; break;case 'B':c[row][col] = 'b'; break;case 'N':c[row][col] = 'n'; break;}m += 4;}else{int col = col = (a[m] - 'a') * 4 + 2;int row = 15 - (int(a[m + 1] - '0') - 1 ) * 2; c[row][col] = 'p';m += 3;}}}void print(int myRow, int myCol){for(int i = 0; i < myRow; i++){for(int j = 0; j < myCol; j++){cout<<c[i][j];}cout<<endl;}}int main(){int myRow = 17;int myCol = 33;init(myRow, myCol);deal(myRow, myCol);print(myRow, myCol);return 0;}
0 0
- POJ2993
- POJ2993
- poj2993
- poj2993
- poj2993
- poj2993
- poj2993 poj2669
- poj2993模拟
- POJ2993&&POJ2996
- POJ2996 & POJ2993 (模拟)
- poj2993 2996(模拟)
- poj2993 与2996相反的模拟
- POJ2993 Emag eht htiw Em Pleh
- poj2993--Emag eht htiw Em Pleh
- POJ2993 - Emag eht htiw Em Pleh
- POJ2993 Emag eht htiw Em Pleh
- 两道很有意思的题目POJ 2996,POJ2993
- POJ2993,Emag eht htiw Em Pleh,跟2996反过来
- #pragma once
- hdu 3572 Task Schedule
- Linux-0.11内核源码分析系列:内存管理get_empty_page()与put_page()函数分析
- ios tableView添加响应事件
- 1019. 数字黑洞 (20) (数学啊 ZJU_PAT)
- poj2993
- hadoop探索-Pseudo-Distributed Operation
- Java中Map值得注意的坑!
- ios UITableView中Cell的操作
- 【j2ee第一弹】struts1之logindemo
- 【j2ee第二弹】spring之logindemo
- HDU 4708
- 用photoshop修改图片大小
- ldd命令