POJ 2993 Emag eht htiw Em Pleh 模拟

http://poj.org/problem?id=2993

模拟大法好。

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 using namespace std;
 5 char q[10],w[100];
 6 char e[10],r[100];
 7 char white[12]= {‘K‘,‘Q‘,‘R‘,‘B‘,‘N‘,‘P‘};
 8 char black[12]= {‘k‘,‘q‘,‘r‘,‘b‘,‘n‘,‘p‘};
 9 char map1[18][35];
10 int s1,s2;
11 int main()
12 {
13     int i,j;
14     for(i=1; i<=17; i++)
15         for(j=1; j<=33; j++)
16         {
17             if(i%2==1&&j%4==1)
18                 map1[i][j]=‘+‘;
19             else  if(i%2==1)
20                 map1[i][j]=‘-‘;
21             else  if(i%2==0&&j%4==1)
22                 map1[i][j]=‘|‘;
23             else if(i%4==2&&(double)(j%8)/4<=1&&j%8!=0)
24                 map1[i][j]=‘.‘;
25             else if(i%4==0&&((double)(j%8)/4>1||j%8==0))
26                 map1[i][j]=‘.‘;
27             else
28                 map1[i][j]=‘:‘;
29         }
30     for(int k=1; k<=2; k++)
31     {
32         scanf("%s%s",q,w);
33         s1=strlen(w);
34         if(q[0]==‘W‘)
35         {
36             for(i=0; i<=5; i++)
37                 for(j=0; j<=s1; j++)
38                 {
39                     if(w[j]==white[i])
40                         map1[2*(9-w[j+2]+‘0‘)][4*(w[j+1]-‘a‘)+3]=white[i];
41                     if(w[j]==‘,‘&&w[j+1]>96)
42                         map1[2*(9-w[j+2]+‘0‘)][4*(w[j+1]-‘a‘)+3]=‘P‘;
43                 }
44         }
45         if(q[0]==‘B‘)
46         {
47             for(i=0; i<=5; i++)
48                 for(j=0; j<=s1; j++)
49                 {
50                     if(w[j]==white[i])
51                         map1[2*(9-w[j+2]+‘0‘)][4*(w[j+1]-‘a‘)+3]=black[i];
52                     if(w[j]==‘,‘&&w[j+1]>96)
53                         map1[2*(9-w[j+2]+‘0‘)][4*(w[j+1]-‘a‘)+3]=‘p‘;
54                 }
55         }
56     }
57     for(i=1; i<=17; i++)
58     {
59         for(j=1; j<=33; j++)
60             cout<<map1[i][j];
61         cout<<endl;
62     }
63     return 0;
64 }

时间: 2024-08-09 11:09:03

POJ 2993 Emag eht htiw Em Pleh 模拟的相关文章

快速切题 poj 2993 Emag eht htiw Em Pleh 模拟

Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2806   Accepted: 1865 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 correspond

Poj 2993 Emag eht htiw Em Pleh

1.Link: http://poj.org/problem?id=2993 2.Content: Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2801   Accepted: 1861 Description This problem is a reverse case of the problem 2996. You are given the output of the

POJ 2993 Emag eht htiw Em Pleh (模拟)(strtok 应用)

http://www.zhuke.com/user/zkuser48082492?1r7R=123.baidu.com&eu=&lvhttp://www.zhuke.com/user/zkuser74628816?1r7R=123.baidu.com&eu=&lvhttp://www.zhuke.com/user/zkuser8162521?1r7R=123.baidu.com&eu=&lvhttp://www.zhuke.com/user/zkuser67

模拟 + 打表 --- Emag eht htiw Em Pleh

Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2578   Accepted: 1731 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 correspond

POJ2993——Emag eht htiw Em Pleh

Emag eht htiw Em Pleh DescriptionThis 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.Inputaccording to output of problem 2996.Outputaccording to input of probl

Emag eht htiw Em Pleh(imitate)

Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2901   Accepted: 1917 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 correspond

poj2993(Emag eht htiw Em Pleh)

题目大意: 给你白棋子的位置: 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模拟出棋盘的情况a-h代表横坐标,1-17代表纵坐标.后面的位置首歌字符没有大写字母的是P,其中白棋子p是大写,黑棋子p是小写.解题思路:一句话太恶心,模拟一小时,我都晕了.代码: 1 #include <algorit

POJ-2993 Emag eht htiw Em Pleh---棋盘模拟

题目链接: https://vjudge.net/problem/POJ-2993 题目大意: 输入和输出和这里相反. 思路: 模拟题,没啥算法,直接模拟,不过为了代码精简,还是花了一点心思的 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<cmath> 6 #include<queue> 7 #i

UVA10205 - Stack &#39;em Up(模拟)

UVA10205 - Stack 'em Up(模拟) 题目链接 题目大意:给你52张牌,这些牌一开始就有个顺序.现在给你每次的洗牌动作,52个数Ai,表示第i个位置上的牌放到Ai位置.意思就是能够通过这次洗牌,可以将i位置上的牌放到Ai位置上.至于后面的牌要不要移动什么的,根本不考虑.反正就是通过这次的洗牌,我给你52个数,把每个位置上的牌更新了一下. 解题思路:之前的题意看错,还以为是每次洗牌然后插入,后面才发现题意是这样的.那么只需要记录下上次洗牌的每个位置的牌,然后在将这次洗牌动作后的每