• Emag eht htiw Em Pleh


     Emag eht htiw Em Pleh

    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
    大家可以去poj 看看原题
    这提题是逆序输出
     1 #include<cstdio>
     2 #include<cstring>
     3 #include<iostream>
     4 #include<cstdlib>
     5 using namespace std;
     6 char s[10][10];
     7 void print(int t)
     8 {
     9     if(t) printf(".");
    10     else printf(":");
    11 }
    12 int main()
    13 {
    14     int xi,yi,i,j,t;
    15     char str[10],ch,x,y;
    16     for(i=1; i<9; i++)
    17         for(j=1; j<9; j++)
    18         {
    19             if((i+j)%2)
    20                 s[i][j]='.';
    21             else s[i][j]=':';
    22         }
    23     for(i=0; i<2; i++)
    24     {
    25         scanf("%s",str);
    26         if(strcmp(str,"White:")==0)
    27         {
    28             while(scanf("%c",&ch)&&ch!='
    ')
    29             {
    30                 if('A'<=ch&&ch<='Z')
    31                 {
    32                     scanf("%c%c",&x,&y);
    33                     xi=x-'a'+1;
    34                     yi=y-'0';
    35                     s[yi][xi]=ch;
    36                 }
    37                 else if('a'<=ch&&ch<'i')
    38                 {
    39                     xi=ch-'a'+1;
    40                     scanf("%c",&y);
    41                     yi=y-'0';
    42                     s[yi][xi]='P';
    43                 }
    44             }
    45         }
    46         else
    47         {
    48             while(scanf("%c",&ch)&&ch!='
    ')
    49             {
    50                 if('A'<=ch&&ch<='Z')
    51                 {
    52                     scanf("%c%c",&x,&y);
    53                     xi=x-'a'+1;
    54                     yi=y-'0';
    55                     s[yi][xi]=ch+32;
    56                 }
    57                 else if('a'<=ch&&ch<'i')
    58                 {
    59                     xi=ch-'a'+1;
    60                     scanf("%c",&y);
    61                     yi=y-'0';
    62                     s[yi][xi]='p';
    63                 }
    64             }
    65         }
    66     }
    67     for(i=8; i>0; i--)
    68     {
    69         printf("+---+---+---+---+---+---+---+---+
    ");
    70         for(j=1; j<9; j++)
    71         {
    72             printf("|");
    73             t=(i+j)%2;
    74             print(t);
    75             printf("%c",s[i][j]);
    76             print(t);
    77         }
    78         printf("|
    ");
    79     }
    80     printf("+---+---+---+---+---+---+---+---+
    ");
    81     return 0;
    82 }
    View Code
  • 相关阅读:
    【转】有关Managed code和Native code的区别
    【转】wince6.0 vs2005 编译选项详解
    【转】Wince Device Emulator使用介绍Device Emulator 2.0
    Dapper基础增删查改、事务和存储过程
    SharpCompress的压缩文件解压和文件夹压缩
    MVC WebAPI 的基本使用
    prepare for travel 旅行准备
    gossip
    JS笔记(3) 词汇结构(待续。。。)
    Good Points Bad Points
  • 原文地址:https://www.cnblogs.com/kongkaikai/p/3241768.html
Copyright © 2020-2023  润新知