快速切题 poj 2993 Emag eht htiw Em Pleh 模拟

Emag eht htiw Em Pleh

Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 2806   Accepted: 1865

Description

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

Input

according to output of problem 2996.

Output

according to input of problem 2996.

Sample Input

White: Ke1,Qd1,Ra1,Rh1,Bc1,Bf1,Nb1,a2,c2,d2,f2,g2,h2,a3,e4
Black: 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.|
+---+---+---+---+---+---+---+---+
#include<cstdio>
#include <cstring>
using namespace std;
char maz[17][34];
int mp[255];
char cell[2][3][6]={
   {
   "+---+",
    "|:::|",
    "+---+",
   },
   {
    "+---+",
    "|...|",
    "+---+",
    }
};
void dye(int x,int y){
    for(int i=0;i<3;i++){
        for(int j=0;j<5;j++){
            maz[2*x+i][4*y+j]=cell[(x+y)&1][i][j];
        }
    }
}
void clearchess(){
    memset(maz,0,sizeof(maz));
    for(int i=0;i<8;i++){
        for(int j=0;j<8;j++){
            dye(i,j);
        }
    }
}
char buff[1024];
void subinsrt(int x,int y,char ch){
    x--;
    maz[2*x+1][4*y+2]=ch;
}
void insrt(bool upc){
    int len=strlen(buff);
    char use;
    for(int i=0;i<len;){
        int j;
        for( j=i;j<len&&buff[j]!=‘,‘;j++){}
        if(j-i==3)use=buff[i];
        else use=‘P‘;
        if(upc)subinsrt(buff[j-1]-‘0‘,mp[buff[j-2]],use);
        else subinsrt(buff[j-1]-‘0‘,mp[buff[j-2]],use-‘A‘+‘a‘);
        i=j+1;
       // for(int i=0;i<17;i++)puts(maz[i]);
    }
}
int main(){
    for(int i=0;i<26;i++)mp[i+‘a‘]=i;
    clearchess();
    scanf("%s",buff);
    scanf("%s",buff);
    insrt(true);
    scanf("%s",buff);
    scanf("%s",buff);
    insrt(false);
    for(int i=16;i>=0;i--)puts(maz[i]);
    return 0;
}

  

时间: 2024-10-07 21:51:10

快速切题 poj 2993 Emag eht htiw Em Pleh 模拟的相关文章

POJ 2993 Emag eht htiw Em Pleh 模拟

http://poj.org/problem?id=2993 模拟大法好. 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 char q[10],w[100]; 6 char e[10],r[100]; 7 char white[12]= {'K','Q','R','B','N','P'}; 8 char black[12]= {'k','q','r

Poj 2993 Emag eht htiw Em Pleh

1.Link: http://poj.org/problem?id=2993 2.Content: Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2801   Accepted: 1861 Description This problem is a reverse case of the problem 2996. You are given the output of the

POJ 2993 Emag eht htiw Em Pleh (模拟)(strtok 应用)

http://www.zhuke.com/user/zkuser48082492?1r7R=123.baidu.com&eu=&lvhttp://www.zhuke.com/user/zkuser74628816?1r7R=123.baidu.com&eu=&lvhttp://www.zhuke.com/user/zkuser8162521?1r7R=123.baidu.com&eu=&lvhttp://www.zhuke.com/user/zkuser67

POJ2993——Emag eht htiw Em Pleh

Emag eht htiw Em Pleh DescriptionThis problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the corresponding input.Inputaccording to output of problem 2996.Outputaccording to input of probl

Emag eht htiw Em Pleh(imitate)

Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2901   Accepted: 1917 Description This problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the correspond

模拟 + 打表 --- Emag eht htiw Em Pleh

Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2578   Accepted: 1731 Description This problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the correspond

poj2993(Emag eht htiw Em Pleh)

题目大意: 给你白棋子的位置: White: Ke1,Qd1,Ra1,Rh1,Bc1,Bf1,Nb1,a2,c2,d2,f2,g2,h2,a3,e4和黑棋子的位置:Black: Ke8,Qd8,Ra8,Rh8,Bc8,Ng8,Nc6,a7,b7,c7,d7,e7,f7,h7,h6模拟出棋盘的情况a-h代表横坐标,1-17代表纵坐标.后面的位置首歌字符没有大写字母的是P,其中白棋子p是大写,黑棋子p是小写.解题思路:一句话太恶心,模拟一小时,我都晕了.代码: 1 #include <algorit

POJ-2993 Emag eht htiw Em Pleh---棋盘模拟

题目链接: https://vjudge.net/problem/POJ-2993 题目大意: 输入和输出和这里相反. 思路: 模拟题,没啥算法,直接模拟,不过为了代码精简,还是花了一点心思的 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<cmath> 6 #include<queue> 7 #i

快速切题 poj 2996 Help Me with the Game 模拟暴力

Help Me with the Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3510   Accepted: 2251 Description Your task is to read a picture of a chessboard position and print it in the chess notation. Input The input consists of an ASCII-art