poj 2993--Emag eht htiw Em Pleh

题目跟2996一样的,就是把2996的结果和问题换了一下而已,做法思想不变。模拟题。。

View Code
  1 #include <stdio.h>
  2 #include <string.h>
  3 char ss[]= {"+---+---+---+---+---+---+---+---+"};
  4 char map[10][100];
  5 void init()
  6 {
  7     int i;
  8     for(i=0; i<8; i++)
  9     {
 10         if(i&1)
 11             strcpy(map[i],"|:::|...|:::|...|:::|...|:::|...|");
 12         else
 13             strcpy(map[i],"|...|:::|...|:::|...|:::|...|:::|");
 14     }
 15 }
 16 int main()
 17 {
 18     init();
 19     char s[100],c[20],str[10];
 20     int x,y;
 21     int i,j;
 22     scanf("%s %s",c,s);
 23     for(i=0,j=0; s[i]; i++)
 24     {
 25         if(s[i]!=',')
 26             str[j++]=s[i];
 27         else
 28         {
 29             str[j]=0;
 30             j=0;
 31             if(strlen(str)==3)
 32             {
 33                 x=str[1]-'a';
 34                 y=str[2]-'0';
 35                 map[8-y][4*x+2]=str[0];
 36             }
 37             else
 38             {
 39                 x=str[0]-'a';
 40                 y=str[1]-'0';
 41                 map[8-y][4*x+2]='P';
 42             }
 43         }
 44     }
 45     str[j]=0;
 46     j=0;
 47     if(strlen(str)==3)
 48     {
 49         x=str[1]-'a';
 50         y=str[2]-'0';
 51         map[8-y][4*x+2]=str[0];
 52     }
 53     else
 54     {
 55         x=str[0]-'a';
 56         y=str[1]-'0';
 57         map[8-y][4*x+2]='P';
 58     }
 59 
 60     scanf("%s %s",c,s);
 61     for(i=0,j=0; s[i]; i++)
 62     {
 63         if(s[i]!=',')
 64             str[j++]=s[i];
 65         else
 66         {
 67             str[j]=0;
 68             j=0;
 69             if(strlen(str)==3)
 70             {
 71                 x=str[1]-'a';
 72                 y=str[2]-'0';
 73                 map[8-y][4*x+2]=str[0]-'A'+'a';
 74             }
 75             else
 76             {
 77                 x=str[0]-'a';
 78                 y=str[1]-'0';
 79                 map[8-y][4*x+2]='p';
 80             }
 81         }
 82     }
 83     str[j]=0;
 84     j=0;
 85     if(strlen(str)==3)
 86     {
 87         x=str[1]-'a';
 88         y=str[2]-'0';
 89         map[8-y][4*x+2]=str[0]-'A'+'a';
 90     }
 91     else
 92     {
 93         x=str[0]-'a';
 94         y=str[1]-'0';
 95         map[8-y][4*x+2]='p';
 96     }
 97     printf("%s\n",ss);
 98     for(i=0;i<8;i++)
 99     {
100         printf("%s\n",map[i]);
101         printf("%s\n",ss);
102     }
103     return 0;
104 }

 

转载于:https://www.cnblogs.com/wilsonjuxta/archive/2013/03/11/2953754.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值