扯淡题。

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. Oracle数据库之PL/SQL包

    Oracle数据库之PL/SQL包 1. 简介 包(PACKAGE)是一种数据对象,它是一组相关过程.函数.变量.常量和游标等PL/SQL程序设计元素的组合,作为一个完整的单元存储在数据库中,用名称来 ...

  2. 命令行,备份、导入数据库Oracle

    备份库:exp username/password@Database file="h:\datas.dmp" owner=username 导入语句 :imp username2/ ...

  3. 【面霸1】php知识点

    PHP简介 Hypertext Preprocessor,超文本预处理器的缩写,主要是用于服务端的脚本程序 PHP 标记风格 1.xml风格   < ? php ? > 2.脚本风格  & ...

  4. &lt和&gt

    今天用到&gt查了查资料就是这么个回事.

  5. WCF返回JSON的详细配置

    开发环境:VS2008,c# 1.新建个WCF服务网站 文件-新建-网站-WCF服务 2,运行一下,提示配置WEB.CONFIG,点击确认. 3,打开web.config增加如下节点: <ser ...

  6. 如何编写一个简单的makefile

    一个规则的构成 目标:依赖1,依赖2······ 命令 例子: objs := init.o nand.o head.o main.o nand.bin : $(objs) arm-linux-ld ...

  7. .NET 4.0 使用 asyn await

    .NET 4.0 也可以使用asyn await 使用nuget 搜索await即可发现微软官方包,安装导项目就可以使用了.   参考:http://stackoverflow.com/questio ...

  8. DotNet 资源

    DotNet 资源 目录 API 应用框架(Application Frameworks) 应用模板(Application Templates) 人工智能(Artificial Intelligen ...

  9. 利用多线程资源竞争技术上传shell

    通过多线程资源竞争的手段同时上传两个头像,就可以在Apache+Rails环境下实现远程代码执行.这并不是天方夜谭,同时我相信许多文件上传系统都会有这个漏洞……这是一个非常有趣的安全实验,一起来看看吧 ...

  10. Java类加载的时机

    类是什么时候初始化的?类初始化的时候会执行static块,这个是我们知道的.那么我们可以用static块来做个实验. 上面代码输出是: hello worldinitthis is a test这说明 ...