POJ 2993
发布日期:2021-06-30 15:30:52 浏览次数:2 分类:技术文章

本文共 3480 字,大约阅读时间需要 11 分钟。

Emag eht htiw Em Pleh

Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 4115   Accepted: 2637

Description

This problem is a reverse case of the . You are given the output of the problem H and your task is to find the corresponding input.

Input

according to output of .

Output

according to input of .

Sample Input

White: Ke1,Qd1,Ra1,Rh1,Bc1,Bf1,Nb1,a2,c2,d2,f2,g2,h2,a3,e4Black: Ke8,Qd8,Ra8,Rh8,Bc8,Ng8,Nc6,a7,b7,c7,d7,e7,f7,h7,h6

Sample Output

+---+---+---+---+---+---+---+---+|.r.|:::|.b.|:q:|.k.|:::|.n.|:r:|+---+---+---+---+---+---+---+---+|:p:|.p.|:p:|.p.|:p:|.p.|:::|.p.|+---+---+---+---+---+---+---+---+|...|:::|.n.|:::|...|:::|...|:p:|+---+---+---+---+---+---+---+---+|:::|...|:::|...|:::|...|:::|...|+---+---+---+---+---+---+---+---+|...|:::|...|:::|.P.|:::|...|:::|+---+---+---+---+---+---+---+---+|:P:|...|:::|...|:::|...|:::|...|+---+---+---+---+---+---+---+---+|.P.|:::|.P.|:P:|...|:P:|.P.|:P:|+---+---+---+---+---+---+---+---+|:R:|.N.|:B:|.Q.|:K:|.B.|:::|.R.|+---+---+---+---+---+---+---+---+

Source

 

代码:

//poj2993 poj2996 的逆向题目 #include 
#include
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<

 

转载地址:https://joycez.blog.csdn.net/article/details/82793830 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:POJ 2996
下一篇:2018 杭州见习报告

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2024年04月08日 03时32分58秒