POJ 2993-Emag eht htiw Em Pleh(模拟)

来源:互联网 发布:haya乐团 知乎 编辑:程序博客网 时间:2024/06/10 12:59

题目地址:POJ 2993
这道题POJ 2996的逆推

#include <stdio.h>#include <math.h>#include <string.h>#include <stdlib.h>#include <iostream>#include <sstream>#include <algorithm>#include <set>#include <queue>#include <stack>#include <map>using namespace std;typedef long long LL;const int inf=0x3f3f3f3f;const double pi= acos(-1.0);const double esp=1e-6;char str1[40],str2[40];char mp[40][40];int main(){    int i,j;    for(i=0; i<8; i++) {        for(j=0; j<8; j++) {            mp[i*2][4*j]='+';            mp[i*2][4*j+1]=mp[i*2][4*j+2]=mp[i*2][4*j+3]='-';            mp[i*2+1][4*j]='|';        }        mp[2*i][4*j]='+';        mp[2*i][4*j+1]='\0';        mp[2*i+1][4*j]='|';        if(i==7) {            for(j=0; j<8; j++) {                mp[2*(i+1)][4*j]='+';                mp[2*(i+1)][4*j+1]=mp[2*(i+1)][4*j+2]=mp[2*(i+1)][4*j+3]='-';            }            mp[2*(i+1)][4*j]='+';            mp[2*(i+1)][4*j+1]='\0';        }        for(j=0; j<8; j++) {            if((i+j)%2) {                mp[2*i+1][4*j+1]=mp[2*i+1][4*j+2]=mp[2*i+1][4*j+3]=':';            } else {                mp[2*i+1][4*j+1]= mp[2*i+1][4*j+2]=mp[2*i+1][4*j+3]='.';            }        }        mp[2*i+1][4*j+1]='\0';    }    scanf("%s %s",&str1,&str2);    for(int i=0; str2[i]!=0;) {        if(str2[i]==',') {            i++;            continue;        }        if(str2[i]>='A'&&str2[i]<='Z') {            int x=8-(str2[i+2]-'0');            int y=str2[i+1]-'a';            mp[2*x+1][4*y+2]=str2[i];            i+=3;        } else {            int x=8-(str2[i+1]-'0');            int y=str2[i+0]-'a';            mp[2*x+1][4*y+2]='P';            i+=2;        }    }    scanf("%s %s",&str1,&str2);    for(int i=0; str2[i]!=0;) {        if(str2[i]==',') {            i++;            continue;        }        if(str2[i]>='A'&&str2[i]<='Z') {            int x=8-(str2[i+2]-'0');            int y=str2[i+1]-'a';            mp[2*x+1][4*y+2]=str2[i]-'A'+'a';            i+=3;        } else {            int x=8-(str2[i+1]-'0');            int y=str2[i+0]-'a';            mp[2*x+1][4*y+2]='p';            i+=2;        }    }    for(int i=0; i<17; i++)        printf("%s\n",mp[i]);    return 0;}
1 0
原创粉丝点击