acm-Not That Kind of Graph-uva10800
来源:互联网 发布:监控显示无网络视频 编辑:程序博客网 时间:2024/06/07 05:33
#include <cstdio> #include <cstring> #include <algorithm> #include <map> using namespace std; const int N = 130; char grid[N][N]; char buf[N]; int rowNum[N]; map<char, char> m; int main() { int t; int row, col; int minRow, maxRow; #ifndef ONLINE_JUDGE freopen("uva_in.txt", "r", stdin); #endif m['R'] = '/'; m['C'] = '_'; m['F'] = '\\'; scanf("%d", &t); for (int i = 1; i <= t; i++) { scanf("%s", buf); printf("Case #%d:\n", i); memset(grid, ' ', sizeof(grid)); memset(rowNum, 0x00, sizeof(rowNum)); minRow = maxRow = N / 2; row = N / 2, col = 0; bool first = true; char ch; for (int j = 0; buf[j]; j++) { if (first) { first = false; ch = buf[j]; grid[row][col++] = m[ch]; rowNum[row] = max(rowNum[row], col); } else { if (ch == 'R' && buf[j] != 'F') { row--; minRow = min(row, minRow); grid[row][col++] = m[buf[j]]; } else if ((ch == 'F'|| ch == 'C') && buf[j] == 'F') { row++; maxRow = max(row, maxRow); grid[row][col++] = m[buf[j]]; } else { grid[row][col++] = m[buf[j]]; } rowNum[row] = max(rowNum[row], col); ch = buf[j]; } } for (int i = minRow; i <= maxRow; i++) { printf("| "); for (int j = 0; j < rowNum[i]; j++) { printf("%c", grid[i][j]); } printf("\n"); } printf("+-"); for (int j = 0; buf[j]; j++) { printf("-"); } printf("-\n"); printf("\n"); } return 0; }
uva_in.txt
15
RRRCFCRFRFFCCCR
RRR
CCCCCC
CRCFRCFRRFR
CRRRFCFRCFRFC
RCRFCRFFCCRRC
RRRFFFFFFFFFF
RCRFCRFFCCRRC
FCFCCFRRCCFFC
RCRFCRFFCCRRC
R
F
C
RFRFRFCCCRF
FFF
Output
Case #1:| _| / \_/\/\| / \___/| /+-----------------Case #2:| /| /| /+-----Case #3:| ______+--------Case #4:| _ _ /\/| _/ \/ \/+-------------Case #5:| /\_ _| / \/ \/\_| _/+---------------Case #6:| _| _/\_/\ /| / \__/+---------------Case #7:| /\| / \| / \| \| \| \| \| \| \| \+---------------Case #8:| _| _/\_/\ /| / \__/+---------------Case #9:| \_ __| \__ / \| \/ \_+---------------Case #10:| _| _/\_/\ /| / \__/+---------------Case #11:| /+---Case #12:| \+---Case #13:| _+---Case #14:| /\/\/\___/\+-------------Case #15:| \| \| \+-----
0 0
- acm-Not That Kind of Graph-uva10800
- UVa 10800 - Not That Kind of Graph
- kind of ! kind of !
- cgo: could not determine kind of name for C.*
- The parameter is (or has an element that is) the wrong kind of geometry
- The parameter is (or has an element that is) the wrong kind of geometry
- There is only one kind of failure,that is to give up halfway.
- Kind of lost
- Another kind of Fibonacci
- Problem A - Sum Kind Of Problem 2015 ACM/ICPC Greater New York Region
- iOS 如何解决'could not dequeue a view of kind: UICollectionElementKindCell with identifier cell
- reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier cellIdentifie
- Kind of Comments(注释种类)
- The second kind of hopeness...
- HDU3306 Another kind of Fibonacci
- Another kind of Fibonacci(矩阵)
- hdu3306 Another kind of Fibonacci
- hdu3306 Another kind of Fibonacci
- 安装Linux的源代码包
- C#中获取当前时间:System.DateTime.Now.ToString()用法
- android的原理,为什么不需要手动关闭程序
- sizeof
- Cocosbuilder3.x使用
- acm-Not That Kind of Graph-uva10800
- 基于IOS的FTP详解(三)下载和断点续传
- 数字整除
- JAVA对象转换为JSON字符串
- MFC的CListBox控件使用LBS_OWNERDRAWVARIABLE风格不能AddString的问题
- 变量 地址 值
- MySQL数据库常用操作语句大全
- 设计模式 - 代理模式(proxy pattern) 未使用代理模式 详解
- Caused by: java.lang.ClassNotFoundException: org.jbpm.pvm.internal.processengine.SpringHelper