扯淡题。

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. 去除VS2010中中文注释下的红色波浪线

    1,中文注释以分号结尾 2,Assist X 菜单栏->Assist X Option->Underline 选择“min”.

  2. 总结:S5PV210时钟系统

    在数据手册<S5PV210_UM_REV1.1>中的section 02_system/3 CLOCK CONTROLLER(354页)   一.时钟域 在S5PV210的SoC中,时钟系 ...

  3. DataNode工作原理(四)

    DataNode的作用:提供真实文件数据的存储服务.以文件块进行存储. 文件块(block):最基本的存储单位.对文件内容而言,一个文件的长度大小是size,那么从文件的0偏移开始,按照固定的大小,顺 ...

  4. C++例题1:输出可打印字符

    #include<iostream>#include<stdlib.h>#include<cctype>int main(){ int i;char a=0; fo ...

  5. (转载)50个c/c++源代码网站

    C/C++是最主要的编程语言.这里列出了50名优秀网站和网页清单,这些网站提供c/c++源代码.这份清单提供了源代码的链接以及它们的小说明.我已 尽力包括最佳的C/C++源代码的网站.这不是一个完整的 ...

  6. C语言连接MySql数据库

    C语言连接MySql数据库(CodeBlocks) 操作系统:Windows7(32位)编译软件:Code::Blocks 10.05数 据 库:mysql-5.1.62-win32 数据库内的数据: ...

  7. UNIX Filesystems - Evolution Design and Implementation.pdf

    UNIX Filesystems - Evolution Design and Implementation.pdf

  8. linux系统下root用户和普通用户的时区不一致

    1. 发现这个问题是在root下执行 date -R 和 普通用户下执行 date -R,发现时区不一致 2. 在一些linux机器下,发现是一致的 3. 什么原因呢?找了半天,最后发现 时区一致的机 ...

  9. Web工程软件升级之数据库升级(一)

    1. 首先检查oracle数据库版本是否正确 (可以使用方法 lsinventory来实现) 2. 检查oracle连接是否成功 3. 解压升级包,放到特定目录 4. 做升级前数据备份,备份主要业务数 ...

  10. BZOJ 1049 数字序列

    Description 现在我们有一个长度为n的整数序列A.但是它太不好看了,于是我们希望把它变成一个单调严格上升的序列.但是不希望改变过多的数,也不希望改变的幅度太大. Input 第一行包含一个数 ...