zoukankan      html  css  js  c++  java
  • poj2993 翻转2996

    Emag eht htiw Em Pleh
    Time Limit: 1000MS   Memory Limit: 65536K
    Total Submissions: 2944   Accepted: 1949

    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.|
    +---+---+---+---+---+---+---+---+

    Source

     

     

     

     

     

     

     

     

     

    #include<stdio.h>
    #include<string.h>
    char map[10][10],str1[100],str2[100];
    int main(){
    while(gets(str1)){
    gets(str2);
    int len1=strlen(str1);
    int len2=strlen(str2);
    for(int i=0;i<=len1-1;i++){
    if(str1[i]>='1'&&str1[i]<='9'){
    if(str1[i-2]!=',')
    map[str1[i]-'1'+1][str1[i-1]-'a'+1]=str1[i-2];
    else
    map[str1[i]-'1'+1][str1[i-1]-'a'+1]='P';
    }
    }
    for(int i=0;i<=len2-1;i++){
    if(str2[i]>='1'&&str2[i]<='9'){
    if(str2[i-2]!=',')
    map[str2[i]-'1'+1][str2[i-1]-'a'+1]=str2[i-2]+32;
    else
    map[str2[i]-'1'+1][str2[i-1]-'a'+1]='p';
    }
    }

    printf("+---+---+---+---+---+---+---+---+ ");
    for(int i=8;i>=1;i--){
    printf("|");
    for(int j=1;j<=8;j++){
    if((i+j)%2==0){
    printf(":");
    if(map[i][j]) printf("%c",map[i][j]);
    else printf(":");
    printf(":");
    }
    else {
    printf(".");
    if(map[i][j]) printf("%c",map[i][j]);
    else printf(".");
    printf(".");
    }
    printf("|");
    }
    printf(" ");
    printf("+---+---+---+---+---+---+---+---+ ");
    }
    memset(str1,0,sizeof(str1));
    memset(str2,0,sizeof(str2));
    memset(map,0,sizeof(map));
    }
    return 0;
    }

  • 相关阅读:
    【JZOJ3743】【BZOJ5158】Alice and Bob
    【JZOJ3719】K-D-Sequence
    【JZOJ1913】【BZOJ2124】等差子序列
    【JZOJ1914】【BZOJ2125】最短路
    【luoguP4768】【NOI2018】归程
    【JZOJ6435】【luoguP5666】【CSP-S2019】树的重心
    【JZOJ6434】【luoguP5665】【CSP-S2019】划分
    【JZOJ6433】【luoguP5664】【CSP-S2019】Emiya 家今天的饭
    【JZOJ6431】【luoguP5658】【CSP-S2019】括号树
    【JZOJ3673】【luoguP4040】【BZOJ3874】宅男计划
  • 原文地址:https://www.cnblogs.com/13224ACMer/p/4628901.html
Copyright © 2011-2022 走看看