扯淡题。

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. Aspnet MVC 异步调用

    一个简图来描述下Aspnet MVC下的异步调用 { request } / \/ -------ISS------- > work thread | \ | \ route - aysn co ...

  2. QTP的DataTable操作整理(注---不知转载多少遍)

    返回值:数字 示例: 以下示例使用 GetRowCount 方法查找 MySheet 运行时数据表中最长的列中的总行数,并将其写入报告. rowcount = DataTable.GetSheet(& ...

  3. python unicode&str 转化

    从数据库中取出的值是Unicode编码的 需要转化为str才能正常使用 参考: http://www.mamicode.com/info-detail-308445.html

  4. bom type:Phantom

    bom的类型 'type': fields.selection([('normal','Normal BoM'),('phantom','Sets / Phantom')], 'BoM Type', ...

  5. [BZOJ 3207] 花神的嘲讽计划Ⅰ【Hash + 可持久化线段树】

    题目链接:BZOJ - 3207 题目分析 先使用Hash,把每个长度为 k 的序列转为一个整数,然后题目就转化为了询问某个区间内有没有整数 x . 这一步可以使用可持久化线段树来做,虽然感觉可以有更 ...

  6. 看奢侈品Prada如何使用物联网

    这是峰哥在一家国际顶级商学院听课的笔记.这是个巨变的时代,有趣的时代. 一 PRADA在纽约的旗舰店.每件衣服上都有RFID码.每当一个顾客拿起一件PRADA进试衣间,RFID会被自动识别,试衣间里的 ...

  7. 【HDOJ】2822 Dogs

    bfs. /* 2822 */ #include <iostream> #include <cstdio> #include <cstring> #include ...

  8. 离奇“undefined reference”错误分析与解决方案

    离奇“undefined reference”错误分析与解决方案 “undefined reference to XXX”是一类挺常见的链接错误,原因通常是链接时找不到声明成extern类型的函数的定 ...

  9. appendGrid

    appendGrid appendGrid的使用

  10. 【转】ConcurrentModificationException异常解决办法 --不错

    原文网址:http://blog.sina.com.cn/s/blog_465bcfba01000ds7.html 1月30日java.util.ConcurrentModificationExcep ...