zoukankan      html  css  js  c++  java
  • poj2993 模拟

      1 #include <stdio.h>
      2 #include <iostream>
      3 #include <iostream>
      4 using namespace std;
      5 char gird[50][50];
      6 void init()
      7 {
      8     int i,j;
      9     for(i=0;i<17;++i)
     10     {
     11         
     12         for(j=0;j<33;++j)
     13         {
     14             gird[i][j]='~';
     15             if(i%2==0&&j%4==0)
     16                 gird[i][j]='+';
     17             else if(i%2==0)
     18             {
     19                 gird[i][j]='-';
     20             }
     21             else if(i%2==1)
     22             {
     23                 if(j%4==0)
     24                 {
     25                     gird[i][j]='|';        
     26                 }
     27                 else if(j%2==1)
     28                 {
     29                     gird[i][j]='.';
     30 
     31                     if( ( i/2 + j/4   )%2==0 )
     32                     {
     33                         gird[i][j]='.';
     34                     }
     35                     else 
     36                         gird[i][j]=':';
     37                 }
     38             }
     39         }
     40 
     41     }
     42     for(i=0;i<17;++i)
     43         for(j=0;j<33;++j)
     44         {
     45             if(gird[i][j]=='~')
     46             {
     47                 if(gird[i][j+1]=='.')
     48                     gird[i][j]='.';
     49                 else
     50                     gird[i][j]=':';
     51             }
     52         }
     53     return ;
     54 }
     55 
     56 int main()
     57 {
     58     //init();
     59     string sign;
     60     string tmp;
     61     int tx,ty;
     62 
     63     while(cin>>sign)
     64     {
     65         init();
     66         cin>>tmp;
     67         tmp=","+tmp;
     68         for(int i=0;i<tmp.length()-1;++i)
     69         {
     70             if(tmp[i]==',')
     71                 continue;
     72             if(i-1>=0&&tmp[i-1]==',')
     73             {
     74                 if(tmp[i]>='A'&&tmp[i]<='Z')
     75                 {
     76                     tx=tmp[i+2]-'1';
     77                     tx=(8-tx)*2-1;
     78                     ty=tmp[i+1]-'a';
     79                     if(ty==0)    ty=2;
     80                     else        ty=2+4*ty;
     81                     gird[tx][ty]=tmp[i];
     82                 }
     83                 if(tmp[i]>='a'&&tmp[i]<='z')
     84                 {
     85                     tx=tmp[i+1]-'1';
     86                     tx=8-tx;
     87                     tx=tx*2-1;
     88                     ty=tmp[i]-'a';
     89                     if(ty==0)
     90                         ty=2;
     91                     else 
     92                         ty=2+4*ty;
     93                     gird[tx][ty]='P';
     94                 }
     95             }
     96         }
     97         cin>>tmp;
     98         cin>>tmp;
     99         tmp=","+tmp;
    100         for(int i=0;i<tmp.length()-1;++i)
    101         {
    102             if(tmp[i]==',')
    103                 continue;
    104             if(i-1>=0&&tmp[i-1]==',')
    105             {
    106                 if(tmp[i]>='A'&&tmp[i]<='Z')
    107                 {
    108                     tx=tmp[i+2]-'1';
    109                     tx=8-tx;
    110                     tx=tx*2-1;
    111                     ty=tmp[i+1]-'a';
    112                     if(ty==0)
    113                         ty=2;
    114                     else 
    115                         ty=2+4*ty;
    116                     gird[tx][ty]=tmp[i]+32;
    117                 }
    118                 if(tmp[i]>='a'&&tmp[i]<='z')
    119                 {
    120                     tx=tmp[i+1]-'1';
    121                     tx=8-tx;
    122                     tx=tx*2-1;
    123                     ty=tmp[i]-'a';
    124                     if(ty==0)
    125                         ty=2;
    126                     else 
    127                         ty=2+4*ty;
    128                     gird[tx][ty]='p';
    129                 }
    130             }
    131         }
    132         for(int i=0;i<17;++i){
    133             for(int j=0;j<33;++j)
    134                 cout<<gird[i][j];
    135             cout<<endl;
    136         }
    137     }
    138     return 0;
    139 }
  • 相关阅读:
    bzoj3105: [cqoi2013]新Nim游戏
    bzoj2142: 礼物
    bzoj3295: [Cqoi2011]动态逆序对
    THUWC2018酱油记
    hdu5306 Gorgeous Sequence
    高斯消元入门
    bzoj3667: RabinMiller算法
    关于wordpress忘记密码 找回密码的方式
    数据库事务四个特性
    mysql的账户失效,之前的密码无法登录
  • 原文地址:https://www.cnblogs.com/symons1992/p/3029198.html
Copyright © 2011-2022 走看看