poj2993 poj2669
扯淡题。
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的更多相关文章
- POJ-2993 Emag eht htiw Em Pleh---棋盘模拟
题目链接: https://vjudge.net/problem/POJ-2993 题目大意: 输入和输出和这里相反. 思路: 模拟题,没啥算法,直接模拟,不过为了代码精简,还是花了一点心思的 #in ...
- poj2993 翻转2996
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2944 Accepted: ...
- 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 ...
- 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 ...
- poj2993
#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; stru ...
- 【POJ2993】Emag eht htiw Em Pleh
题目传送门 本题知识点:模拟(如果对国际象棋不熟悉的同学可以先百度一下) 本题跟POJ2996是逆过来的操作,如果做过[POJ2996]的同学就不会对题意不理解的了. (以下默认您已AC[POJ299 ...
- POJ2669不错的最大流 竞赛问题(枚举King的个数)
题意: 有n个人,任意两个人都比一次赛(一共比了n*(n-1)/2场),赢一场得到一分,最后的时候如果得分最高,或者是自己打败了所有比自己得分都高的人就算是King,给你每个人的最后得分, ...
- poj分类 很好很有层次感。
初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. ( ...
- 【转】POJ题目分类推荐 (很好很有层次感)
OJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094)初期: 一. ...
随机推荐
- ICE学习第四步-----客户端请求服务器返回数据
这次我们来做一个例子,流程很简单:客户端向服务器发送一条指令,服务端接收到这条指令之后,向客户端发送数据库中查询到的数据,最终显示在DataGridView上. 根据上一篇文章介绍的Slice语法,我 ...
- JQUERY1.9学习笔记 之可见性过滤器(二) 可见选择器
描述:选择所有可见的元素. 例:点击时让所有的可见的div元素变黄. <!doctype html><html lang="en"> <head> ...
- python自动开发之第十八天
一.JS正则 test - 判断字符串是否符合规定的正则 rep = /\d+/; rep.test("asdfoiklfasdf89asdfasdf") # true rep = ...
- python之正则表达式备忘
一简介:就其本质而言,正则表达式(或 RE)是一种小型的.高度专业化的编程语言,(在Python中)它内嵌在Python中,并通过 re 模块实现.正则表达式模式被编译成一系列的字节码,然后由用 C ...
- linux学习笔记---一些有趣的命令
一 在说链接之前我们哈需要说明一个东西,就是inode,一个文件的名字可以有多个,但是inode里的i-number却只有一个,(inode是一个数据结构,里面存放文件的各种属性,属主,属组,权限,大 ...
- angular2 学习笔记 (Typescript - Attribute & reflection)
refer : https://www.npmjs.com/package/reflect-metadata refer : https://www.typescriptlang.org/docs/h ...
- Unity NGUI 3.0.4版本 制作网络版斗地主
Unity NGUI 3.0.4版本 @by 灰太龙 开发环境 Win7旗舰版 Unity 4.2.1f4 本文就写个开门篇,告诉大家怎么用NGUI,第一步导入NGUI 3.0.4版本! 1.启动U ...
- SKYLINE
uvalive4108:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&pag ...
- codeforces C. Valera and Tubes
http://codeforces.com/contest/441/problem/C 题意:有n×m个方格,然后把这些方格分成k部分,每个部分内的方格的坐标满足|xi - xi + 1| + |yi ...
- 自制SCVMM 模板成功
其实,如果通过SCVMM 的PS命令来创建虚拟机的话,模板的意义也不是特别大. 其它的PROFILE和硬件配置都会被替换掉的. ~~~~~~~~~~~~~~~ Windows模版 一. 准备OS的VH ...