扯淡题。

2993

#include <iostream>
#include <stdio.h>
#include <string>
#include <stdlib.h> using namespace std; char map[10][10]; int main()
{
string waste1, s1, s2,waste2;
cin>>waste1;
bool fla=true;
if (waste1 == "White:")
{
cin >> s1 >> waste2 >> s2;
}
else
{
cin >> s2 >> waste2 >> s1;
}
for (int k = 0; k <= s1.size(); k++)
{
if (s1[k] == ',' || (k == s1.size()))
{
if (k == 3)//three characters
{
map[7 - s1[k - 1] + '1'][s1[k - 2] - 'a'] = toupper(s1[k - 3]);
}
else if (k == 2)
{
map[7 - s1[k - 1] + '1'][s1[k - 2] - 'a'] = 'P';
}
else
{
if (s1[k - 4] == ',')
{
map[7 - s1[k - 1] + '1'][s1[k - 2] - 'a'] = toupper(s1[k - 3]);
}
else
{
map[7 - s1[k - 1] + '1'][s1[k - 2] - 'a'] = 'P';
}
}
}
}
for (int k = 0; k <= s2.size(); k++)
{
if (s2[k] == ','||(k==s2.size()))
{
if (k == 3)//three characters
{
map[7 - s2[k - 1] + '1'][s2[k - 2] - 'a'] = tolower(s2[k - 3]);
}
else if (k == 2)
{
map[7 - s2[k - 1] + '1'][s2[k - 2] - 'a'] = 'p';
}
else
{
if (s2[k - 4] == ',')
{
map[7 - s2[k - 1] + '1'][s2[k - 2] - 'a'] = tolower(s2[k - 3]);
}
else
{
map[7 - s2[k - 1] + '1'][s2[k - 2] - 'a'] = 'p';
}
}
}
}
for (int i = 0; i < 8; i++)
{
cout<<"+---+---+---+---+---+---+---+---+"<<endl;
for (int j = 0; j < 8; j++)
{
if(fla)
{
cout<<"|.";
if((map[i][j]<='a'||map[i][j]>='z')&&(map[i][j]<='A'||map[i][j]>='Z'))
{
cout<<"..";
}
else
{
cout << map[i][j]<<'.';
} }
else
{
cout<<"|:";
if((map[i][j]<='a'||map[i][j]>='z')&&(map[i][j]<='A'||map[i][j]>='Z'))
{
cout<<"::";
}
else
{
cout << map[i][j]<<':';
}
}
fla=!fla;
///cout << map[i][j] << ' ';
}
cout <<'|'<< endl;
fla=!fla;
}
cout<<"+---+---+---+---+---+---+---+---+"<<endl;
}

poj2996

#include <iostream>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <stdio.h> using namespace std; bool flag = true;
char map[10][10]; void findupper(char c)
{
for (int i = 8; i >= 1; i--)
{
for (int j = 1; j <= 8; j++)
{ if (map[i][j] == c)
{
if (flag)
{
flag = false;
}
else{ cout << ','; }
if (c != 'P' && c != 'p')
cout << (char) toupper(c);
cout << (char) (j + 'a' - 1) << 9 - i;
}
}
}
} void findlower(char c)
{
for (int i = 1; i <= 8; i++)
{
for (int j = 1; j <= 8; j++)
{
if (map[i][j] == c)
{
if (flag)
{
flag = false;
}
else{ cout << ','; }
if (c != 'P' && c != 'p')
cout << (char) toupper(c);
cout << (char) (j + 'a' - 1) << 9 - i;
} }
}
} int main()
{ memset(map, ' ', sizeof(map));
string waste;
getline(cin, waste);
for (int i = 1; i <= 8; i++)
{
string s;
getline(cin, s);
for (int j = 1; j <= 8; j++)
{
if (isalpha(s[4 * j - 2]))
{
map[i][j] = s[4 * j - 2];
}
}
getline(cin, waste);
}
/*for (int i = 1; i <= 8; i++)
{
for (int j = 1; j <= 8; j++)
{
cout << map[i][j] << ' ';
}
cout << endl;
}*/
flag = true;
cout << "White: ";
findupper('K');
findupper('Q');
findupper('R');
findupper('B');
findupper('N');
findupper('P');
cout << endl << "Black: ";
flag = true;
findlower('k');
findlower('q');
findlower('r');
findlower('b');
findlower('n');
findlower('p');
cout << endl;
//system("pause");
}

poj2993 poj2669的更多相关文章

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

    题目链接: https://vjudge.net/problem/POJ-2993 题目大意: 输入和输出和这里相反. 思路: 模拟题,没啥算法,直接模拟,不过为了代码精简,还是花了一点心思的 #in ...

  2. poj2993 翻转2996

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

  3. POJ2993——Emag eht htiw Em Pleh(字符串处理+排序)

    Emag eht htiw Em Pleh DescriptionThis problem is a reverse case of the problem 2996. You are given t ...

  4. POJ2993——Help Me with the Game(字符串处理+排序)

    Help Me with the Game DescriptionYour task is to read a picture of a chessboard position and print i ...

  5. poj2993

    #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; stru ...

  6. 【POJ2993】Emag eht htiw Em Pleh

    题目传送门 本题知识点:模拟(如果对国际象棋不熟悉的同学可以先百度一下) 本题跟POJ2996是逆过来的操作,如果做过[POJ2996]的同学就不会对题意不理解的了. (以下默认您已AC[POJ299 ...

  7. POJ2669不错的最大流 竞赛问题(枚举King的个数)

    题意:       有n个人,任意两个人都比一次赛(一共比了n*(n-1)/2场),赢一场得到一分,最后的时候如果得分最高,或者是自己打败了所有比自己得分都高的人就算是King,给你每个人的最后得分, ...

  8. poj分类 很好很有层次感。

    初期: 一.基本算法:      (1)枚举. (poj1753,poj2965)      (2)贪心(poj1328,poj2109,poj2586)      (3)递归和分治法.      ( ...

  9. 【转】POJ题目分类推荐 (很好很有层次感)

    OJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094)初期: 一. ...

随机推荐

  1. Java学习----创建对象的数组

    1.初始化数组的长度 2.初始化每个元素对象 3.调用每个对象的方法 public class Student { private String name; public Student() {} p ...

  2. 我摘录的js代码

    1.修改样式 document.getElementByIdx( "div1").style.display = "none"; 2.鼠标悬停图标变小手 sty ...

  3. Discuz!源代码阅读笔记之common.inc.php文件【1】

    <?php /* [Discuz!] (C)2001-2007 Comsenz Inc. This is NOT a freeware, use is subject to license te ...

  4. F题 - A+B for Input-Output Practice (V)

      Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   Description You ...

  5. Mvc Controller 单元测试 Mock User.Identity.Name

    被测试的Action 包含 User.Identity.Name 代码,在写测试代码需要Mock ControllerContext对象 代码如下: var mock = new Mock<Co ...

  6. JQuery重要知识点

    jQuery基本选择器----包括ID选择器,标签选择器,类选择器,通配选择器和组选择器5种 a. ID选择器: $("#id") b. 标签选择器:$("element ...

  7. PYTHON之批量文件指定字符串替换

    在工作应用中,运维自动化的基础是标准化. 而标准化的工作,是难点,在公司相关部门的配合. 那么,在有标准化之后,相应的部署脚本,就比较好写了. 贡献一个在类似环境下可以运用的东东.. 当然,可以写得更 ...

  8. DB2中时间格式化

    values to_char(current timestamp - 7 hours,'hh24')||'点' values varchar(hour(current time + 5 hour))| ...

  9. Poetize6: Acting Cute

    3042: Acting Cute Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 59  Solved: 36[Submit][Status] Des ...

  10. 实战weblogic集群之创建节点和集群

    一.启动weblogic,访问控制台 weblogic的domain创建完成后,接下来就可以启动它,步骤如下: $ cd /app/sinova/domains/base_domain/bin $ . ...