poj2993
来源:互联网 发布:mac safari 扩展插件 编辑:程序博客网 时间:2024/05/22 08:20
摘要:poj2996问题的对应版本.基本思路就是读入所需要的坐标数据,存入一个字符数组,然后记录下作为分界线的符号,进行相应的格式变换就好.
#include<iostream>#include "string"#include<stdio.h>#include "utility"using namespace std;const int cutoff1 = 1 - 'a',cutoff2 = 1 - '1';char board[9][9];const string s1 = "+---+---+---+---+---+---+---+---+";const string s2 = "|:::|...|:::|...|:::|...|:::|...|";const string s3 = "|...|:::|...|:::|...|:::|...|:::|";void print(){ for (int line = 17; line != 0; --line) { if (line % 2 == 0) { string ans = (line/2)%2 == 0 ? s3:s2; for (size_t i = 0; i != ans.size(); ++i) { if (i % 4 == 2) { int index = (i - 2) / 4; ans[i] = isalpha(board[line/2][index+1])?board[line/2][index+1]:ans[i]; } } cout << ans << endl; } else cout << s1 << endl; }}int main(){ string name; for (int i = 1; i != 5; ++i) { cin >> name; if (name == "White:" || name == "Black:") continue; for (auto it = name.begin(); it != name.end();) { if (*it != ',') { int x = isupper(*it) ? *(it + 2) + cutoff2 : *(it + 1) + cutoff2; int y = isupper(*it) ? *(it + 1) + cutoff1 : *it + cutoff1; board[x][y] = isupper(*it) ? (i==2?*it:tolower(*it)) : (i == 2 ? 'P' : 'p'); it += isupper(*it) ? 3 : 2; } else ++it; } } print(); return 0;}
0 0
- POJ2993
- POJ2993
- poj2993
- poj2993
- poj2993
- poj2993
- poj2993 poj2669
- poj2993模拟
- POJ2993&&POJ2996
- POJ2996 & POJ2993 (模拟)
- poj2993 2996(模拟)
- poj2993 与2996相反的模拟
- POJ2993 Emag eht htiw Em Pleh
- poj2993--Emag eht htiw Em Pleh
- POJ2993 - Emag eht htiw Em Pleh
- POJ2993 Emag eht htiw Em Pleh
- 两道很有意思的题目POJ 2996,POJ2993
- POJ2993,Emag eht htiw Em Pleh,跟2996反过来
- Collaborative Filtering
- vc编译qt的文
- LeetCode---Missing Number
- Hibernate 缓存机制
- Generate Parentheses
- poj2993
- 柏林噪声实践 水与火,顶点纹理拾取
- static const
- iOS 传值问题总结
- 在集群上搭建speedy
- iOS开发之new 和 alloc init的区别
- 小米手机3,小米手机4 官方移动稳定版最新 ROM V6.7.1.0.KXDCNCH
- UIscrollView 属性总结
- Mapped Statements collection does not contain value for......